Fix highlight color

This commit is contained in:
Night Kaly 2024-10-24 11:28:24 +01:00
parent 37cbae591c
commit 506ec0cb6d
Signed by: night0721
SSH key fingerprint: SHA256:B/hgVwUoBpx5vdNsXl9w8XwZljA9766uk6T4ubZp5HM

11
nsh.c
View file

@ -261,9 +261,7 @@ int main(int argc, char **argv)
}
if (isspace(buffer[i]) || (ispunct(buffer[i]) &&
buffer[i] != '_' && buffer[i] != '#')) {
if (word_len > 0 && buffer[i] != '*' &&
buffer[i] != '&' && buffer[i] != '=' &&
buffer[i] != '+' && buffer[i] != '|') {
if (word_len > 0) {
word[word_len] = '\0';
if (buffer[i] == '(' && !is_keyword(word) &&
!is_type(word)) {
@ -291,14 +289,9 @@ int main(int argc, char **argv)
buffer[i] == '|' || buffer[i] == '!' ||
buffer[i] == '<' || buffer[i] == '>') {
word[word_len++] = buffer[i];
if (buffer[i+1] != '*' && buffer[i+1] != '&' &&
buffer[i+1] != '=' && buffer[i+1] != '+' &&
buffer[i+1] != '|' && buffer[i] != '!'&&
buffer[i] != '<' && buffer[i] != '>') {
word[word_len] = '\0';
highlight_symbol(word);
word_len = 0;
}
highlight_symbol(word);
continue;
}
printf("%c", buffer[i]);