From 2a0d604c7e1c98f5a08ff247df0c560e27061fd6 Mon Sep 17 00:00:00 2001 From: night0721 Date: Tue, 12 Nov 2024 02:10:36 +0000 Subject: [PATCH] Fix detecting as include when using < and remove debug lines --- vip.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/vip.c b/vip.c index 2fc47e1..8f4b657 100644 --- a/vip.c +++ b/vip.c @@ -701,7 +701,7 @@ int is_separator(int c) int is_symbol(int c) { - return strchr("+-/*=~%><", c) != NULL; + return strchr("+-/*=~%><:?", c) != NULL; } void update_highlight(row_t *row) @@ -786,7 +786,8 @@ void update_highlight(row_t *row) prev_sep = 1; continue; } else { - if (c == '<') { + if (c == '<' && (row->render[i-1] == 'e' || (row->render[i-1] == ' ' && + row->render[i-2] == 'e'))) { in_include = 1; row->hl[i] = STRING; i++; @@ -812,8 +813,7 @@ void update_highlight(row_t *row) continue; } - if (c == '*' || c == '&' || c == '=' || c == '+' || c == '|' || c == '!' || - c == '<' || c == '>') { + if (is_symbol(c)) { row->hl[i] = SYMBOL; prev_sep = 1; i++; @@ -844,11 +844,9 @@ void update_highlight(row_t *row) char word[128]; int word_len = 0; while (!is_separator(row->render[i])) { - printf("i: %d, row->render[i]: %c\n", i, row->render[i]); word[word_len++] = row->render[i++]; } word[word_len] = '\0'; - printf("word: %s\n", word); if (row->render[i] == '(') { memset(&row->hl[i - word_len], KW_FN, word_len); prev_sep = 1;