Fix comment and color for valid command, while change histfile name
This commit is contained in:
parent
77855ac6f9
commit
7fcaa3ba9b
2 changed files with 4 additions and 4 deletions
|
@ -1,7 +1,7 @@
|
|||
#ifndef CONSTANTS_H_
|
||||
#define CONSTANTS_H_
|
||||
|
||||
#define HISTFILE ".90s_history" // history file name
|
||||
#define HISTFILE "90s_history" // history file name
|
||||
#define TOK_BUFSIZE 64 // buffer size of each token
|
||||
#define RL_BUFSIZE 1024 // size of each command
|
||||
#define TOK_DELIM " \t\r\n\a" // delimiter for token
|
||||
|
|
|
@ -124,15 +124,15 @@ void highlight(char *buffer, char **paths) {
|
|||
if (valid) {
|
||||
if (command_without_arg != NULL) {
|
||||
buffer += cmd_len;
|
||||
printf("\x1b[38;2;137;180;250m%s\x1b[0m\x1b[38;2;255;255;255m%s\x1b[0m", command_without_arg, buffer); // print green as valid command, but only color the command, not the arguments
|
||||
printf("\x1b[38;2;166;227;161m%s\x1b[0m\x1b[38;2;255;255;255m%s\x1b[0m", command_without_arg, buffer); // print green as valid command, but only color the command, not the arguments
|
||||
buffer -= cmd_len;
|
||||
} else {
|
||||
printf("\x1b[38;2;137;180;250m%s\x1b[0m", buffer); // print green as valid command
|
||||
printf("\x1b[38;2;166;227;161m%s\x1b[0m", buffer); // print green as valid command
|
||||
}
|
||||
} else {
|
||||
if (command_without_arg != NULL) {
|
||||
buffer += cmd_len;
|
||||
printf("\x1b[38;2;243;139;168m%s\x1b[0m\x1b[38;2;255;255;255m%s\x1b[0m", command_without_arg, buffer); // print green as valid command, but only color the command, not the arguments
|
||||
printf("\x1b[38;2;243;139;168m%s\x1b[0m\x1b[38;2;255;255;255m%s\x1b[0m", command_without_arg, buffer); // print red as invalid command, but only color the command, not the arguments
|
||||
buffer -= cmd_len;
|
||||
} else {
|
||||
printf("\x1b[38;2;243;139;168m%s\x1b[0m", buffer); // print red as invalid command
|
||||
|
|
Loading…
Reference in a new issue