Fixes rendering glitch for resuming normal foreground color
This commit is contained in:
parent
fb2d22d019
commit
e310844ef3
2
config.h
2
config.h
|
@ -17,7 +17,7 @@ static const int use_alternate_screen = 1; // use as bool (0 or 1)
|
||||||
* see: https://en.wikipedia.org/wiki/ANSI_escape_code#8-bit
|
* see: https://en.wikipedia.org/wiki/ANSI_escape_code#8-bit
|
||||||
*/
|
*/
|
||||||
static const unsigned int EDITOR_BG_COLOR = 235;
|
static const unsigned int EDITOR_BG_COLOR = 235;
|
||||||
static const unsigned int VISUAL_BG_COLOR = 69;
|
static const unsigned int VISUAL_BG_COLOR = 69;
|
||||||
static const unsigned int HL_NUMBER_COLOR = 207;
|
static const unsigned int HL_NUMBER_COLOR = 207;
|
||||||
static const unsigned int HL_STRING_COLOR = 116;
|
static const unsigned int HL_STRING_COLOR = 116;
|
||||||
static const unsigned int HL_COMMENT_COLOR = 243;
|
static const unsigned int HL_COMMENT_COLOR = 243;
|
||||||
|
|
6
hermes.c
6
hermes.c
|
@ -735,12 +735,12 @@ void editorDrawRows(struct abuf *ab) {
|
||||||
abAppend(ab, buf, clen);
|
abAppend(ab, buf, clen);
|
||||||
}
|
}
|
||||||
} else if (hl[j] == HL_NORMAL) {
|
} else if (hl[j] == HL_NORMAL) {
|
||||||
|
int color = editorSyntaxToColor(hl[j]);
|
||||||
if (current_color != -1) {
|
if (current_color != -1) {
|
||||||
int color = editorSyntaxToColor(hl[j]);
|
current_color = -1;
|
||||||
char buf[16];
|
char buf[16];
|
||||||
int clen = snprintf(buf, sizeof(buf), "\033[38;5;%dm", color);
|
int clen = snprintf(buf, sizeof(buf), "\033[38;5;%dm", color);
|
||||||
abAppend(ab, "\033[39m", clen);
|
abAppend(ab, buf, clen);
|
||||||
current_color = -1;
|
|
||||||
}
|
}
|
||||||
editorDrawVisualBg(ab, 0, j, filerow, len);
|
editorDrawVisualBg(ab, 0, j, filerow, len);
|
||||||
abAppend(ab, &c[j], 1);
|
abAppend(ab, &c[j], 1);
|
||||||
|
|
16
syntaxhl.h
16
syntaxhl.h
|
@ -69,7 +69,7 @@ char *SH_HL_keywords[] = {
|
||||||
"export", "else", "while", "do|", "done|", "for", "until", "case",
|
"export", "else", "while", "do|", "done|", "for", "until", "case",
|
||||||
"esac", "break|", "continue|", "exit", "return", "trap|", "wait|",
|
"esac", "break|", "continue|", "exit", "return", "trap|", "wait|",
|
||||||
"eval|", "exec|", "ulimit|", "umask|", NULL
|
"eval|", "exec|", "ulimit|", "umask|", NULL
|
||||||
}
|
};
|
||||||
|
|
||||||
// HTML
|
// HTML
|
||||||
char *HTML_HL_keywords[] = {
|
char *HTML_HL_keywords[] = {
|
||||||
|
@ -78,7 +78,7 @@ char *HTML_HL_keywords[] = {
|
||||||
"form", "input", "class|", "id|", "href|", "img", "src|", "target|",
|
"form", "input", "class|", "id|", "href|", "img", "src|", "target|",
|
||||||
"style|", "meta", "h1", "h2", "h3", "h4", "h5", "role|", "!DOCTYPE|",
|
"style|", "meta", "h1", "h2", "h3", "h4", "h5", "role|", "!DOCTYPE|",
|
||||||
"script", "type|", "link", "rel|", NULL
|
"script", "type|", "link", "rel|", NULL
|
||||||
}
|
};
|
||||||
|
|
||||||
// PHP
|
// PHP
|
||||||
char *PHP_HL_keywords[] = {
|
char *PHP_HL_keywords[] = {
|
||||||
|
@ -91,14 +91,14 @@ char *PHP_HL_keywords[] = {
|
||||||
"isset|", "list|", "namespace", "new|", "or|", "print|", "private|", "protected|",
|
"isset|", "list|", "namespace", "new|", "or|", "print|", "private|", "protected|",
|
||||||
"public|", "require", "require_once", "return", "static|", "switch", "throw",
|
"public|", "require", "require_once", "return", "static|", "switch", "throw",
|
||||||
"trait|", "try", "unset|", "use|", "var|", "while", "xor|", "yield", NULL
|
"trait|", "try", "unset|", "use|", "var|", "while", "xor|", "yield", NULL
|
||||||
}
|
};
|
||||||
|
|
||||||
// Lua
|
// Lua
|
||||||
char *LUA_HL_keywords[] = {
|
char *LUA_HL_keywords[] = {
|
||||||
"function", "return", "for", "while", "do", "if", "else", "elseif",
|
"function", "return", "for", "while", "do", "if", "else", "elseif",
|
||||||
"and|", "or|", "false|", "true|", "nil|", "until", "then|", "repeat|",
|
"and|", "or|", "false|", "true|", "nil|", "until", "then|", "repeat|",
|
||||||
"local|", "not|", "in|", "break|", NULL
|
"local|", "not|", "in|", "break|", NULL
|
||||||
}
|
};
|
||||||
|
|
||||||
static struct editorSyntax HLDB[] = {
|
static struct editorSyntax HLDB[] = {
|
||||||
// 3. Add an entry to the editorSyndax db (this var).
|
// 3. Add an entry to the editorSyndax db (this var).
|
||||||
|
@ -136,19 +136,19 @@ static struct editorSyntax HLDB[] = {
|
||||||
"shell",
|
"shell",
|
||||||
SH_HL_extensions,
|
SH_HL_extensions,
|
||||||
"#",
|
"#",
|
||||||
NULL,
|
"",
|
||||||
NULL,
|
"",
|
||||||
SH_HL_keywords,
|
SH_HL_keywords,
|
||||||
HL_HIGHLIGHT_NUMBERS | HL_HIGHLIGHT_STRINGS
|
HL_HIGHLIGHT_NUMBERS | HL_HIGHLIGHT_STRINGS
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"html",
|
"html",
|
||||||
HTML_HL_extensions,
|
HTML_HL_extensions,
|
||||||
NULL,
|
"",
|
||||||
"<!--",
|
"<!--",
|
||||||
"-->",
|
"-->",
|
||||||
HTML_HL_keywords,
|
HTML_HL_keywords,
|
||||||
NULL
|
HL_HIGHLIGHT_NUMBERS
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"php",
|
"php",
|
||||||
|
|
Loading…
Reference in New Issue