Highlight char
This commit is contained in:
parent
f520b71657
commit
a00669be81
2 changed files with 28 additions and 0 deletions
3
config.h
3
config.h
|
@ -24,6 +24,8 @@
|
||||||
#define YELLOW_BG "\033[38;2;249;226;175m"
|
#define YELLOW_BG "\033[38;2;249;226;175m"
|
||||||
#define RED_FG "\033[48;2;243;139;168m"
|
#define RED_FG "\033[48;2;243;139;168m"
|
||||||
#define RED_BG "\033[38;2;243;139;168m"
|
#define RED_BG "\033[38;2;243;139;168m"
|
||||||
|
#define TEAL_FG "\033[48;2;148;226;213m"
|
||||||
|
#define TEAL_BG "\033[38;2;148;226;213m"
|
||||||
|
|
||||||
/* ERROR is red with bold and italic */
|
/* ERROR is red with bold and italic */
|
||||||
#define ERROR "\033[38;2;243;139;168m\033[1m\033[3m"
|
#define ERROR "\033[38;2;243;139;168m\033[1m\033[3m"
|
||||||
|
@ -58,6 +60,7 @@ enum highlight {
|
||||||
KW_FN,
|
KW_FN,
|
||||||
KW_BRACKET,
|
KW_BRACKET,
|
||||||
STRING,
|
STRING,
|
||||||
|
CHAR,
|
||||||
NUMBER,
|
NUMBER,
|
||||||
MATCH,
|
MATCH,
|
||||||
RESET
|
RESET
|
||||||
|
|
25
vip.c
25
vip.c
|
@ -595,6 +595,10 @@ void draw_rows(void)
|
||||||
bprintf(GREEN_BG);
|
bprintf(GREEN_BG);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case CHAR:
|
||||||
|
bprintf(TEAL_BG);
|
||||||
|
break;
|
||||||
|
|
||||||
case SYMBOL:
|
case SYMBOL:
|
||||||
bprintf(SKY_BG);
|
bprintf(SKY_BG);
|
||||||
break;
|
break;
|
||||||
|
@ -772,6 +776,7 @@ void update_highlight(row_t *row)
|
||||||
|
|
||||||
int prev_sep = 1;
|
int prev_sep = 1;
|
||||||
int in_string = 0;
|
int in_string = 0;
|
||||||
|
int in_char = 0;
|
||||||
int in_include = 0;
|
int in_include = 0;
|
||||||
int in_comment = row->idx > 0 && cur_editor->row[row->idx - 1].opened_comment;
|
int in_comment = row->idx > 0 && cur_editor->row[row->idx - 1].opened_comment;
|
||||||
|
|
||||||
|
@ -827,6 +832,26 @@ void update_highlight(row_t *row)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (in_char) {
|
||||||
|
row->hl[i] = CHAR;
|
||||||
|
if (c == '\\' && i + 1 < row->render_size) {
|
||||||
|
row->hl[i + 1] = CHAR;
|
||||||
|
i += 2;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (c == in_char) in_char = 0;
|
||||||
|
i++;
|
||||||
|
prev_sep = 1;
|
||||||
|
continue;
|
||||||
|
} else {
|
||||||
|
if (c == '\'') {
|
||||||
|
in_char = c;
|
||||||
|
row->hl[i] = CHAR;
|
||||||
|
i++;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (in_include) {
|
if (in_include) {
|
||||||
row->hl[i] = STRING;
|
row->hl[i] = STRING;
|
||||||
|
|
Loading…
Reference in a new issue