Fixes foreground color insertion
This commit is contained in:
parent
9eec94d5ca
commit
92db34b4ed
2
config.h
2
config.h
|
@ -23,4 +23,4 @@ static const unsigned int HL_STRING_COLOR = 116;
|
|||
static const unsigned int HL_COMMENT_COLOR = 243;
|
||||
static const unsigned int HL_KEYWORD1_COLOR = 69;
|
||||
static const unsigned int HL_KEYWORD2_COLOR = 167;
|
||||
static const unsigned int HL_DEFAULT_COLOR = 229;
|
||||
static const unsigned int HL_DEFAULT_COLOR = 229;
|
||||
|
|
17
hermes.c
17
hermes.c
|
@ -690,6 +690,9 @@ void editorDrawRows(struct abuf *ab) {
|
|||
int y;
|
||||
for (y = 0; y < E.screenRows; y++) {
|
||||
int filerow = y + E.rowoff;
|
||||
char cbuf[16];
|
||||
int cbuflen = snprintf(cbuf, sizeof(cbuf), "\033[38;5;%dm", HL_DEFAULT_COLOR);
|
||||
abAppend(ab, cbuf, cbuflen);
|
||||
if (filerow >= E.numRows) {
|
||||
if (E.numRows == 0 && y == E.screenRows / 3) {
|
||||
char welcome[80];
|
||||
|
@ -767,6 +770,12 @@ void editorDrawRows(struct abuf *ab) {
|
|||
}
|
||||
|
||||
void editorDrawStatusBar(struct abuf *ab) {
|
||||
char bgcolor[16];
|
||||
int bglen = sprintf(bgcolor, "\033[48;5;%dm", EDITOR_BG_COLOR);
|
||||
char fgcolor[16];
|
||||
int fglen = snprintf(fgcolor, sizeof(fgcolor), "\033[38;5;%dm", HL_DEFAULT_COLOR);
|
||||
abAppend(ab, fgcolor, fglen);
|
||||
abAppend(ab, bgcolor, bglen);
|
||||
abAppend(ab, "\033[7m", 4);
|
||||
char status[80], rstatus[80];
|
||||
|
||||
|
@ -799,14 +808,18 @@ void editorDrawStatusBar(struct abuf *ab) {
|
|||
}
|
||||
}
|
||||
abAppend(ab, "\033[m", 4);
|
||||
char bgcolor[16];
|
||||
int bglen = sprintf(bgcolor, "\033[48;5;%dm", EDITOR_BG_COLOR);
|
||||
abAppend(ab, bgcolor, bglen);
|
||||
abAppend(ab, "\r\n", 2);
|
||||
}
|
||||
|
||||
void editorDrawMsgBar(struct abuf *ab) {
|
||||
abAppend(ab, "\033[K", 3);
|
||||
char bgcolor[16];
|
||||
int bglen = sprintf(bgcolor, "\033[48;5;%dm", EDITOR_BG_COLOR);
|
||||
char fgcolor[16];
|
||||
int fglen = snprintf(fgcolor, sizeof(fgcolor), "\033[38;5;%dm", HL_DEFAULT_COLOR);
|
||||
abAppend(ab, fgcolor, fglen);
|
||||
abAppend(ab, bgcolor, bglen);
|
||||
int msglen = strlen(E.statusmsg);
|
||||
if (msglen > E.screenCols) msglen = E.screenCols;
|
||||
if (msglen && time(NULL) - E.statusmsg_time < 5)
|
||||
|
|
19
syntaxhl.h
19
syntaxhl.h
|
@ -28,6 +28,7 @@ char *SH_HL_extensions[] = {".sh", NULL};
|
|||
char *HTML_HL_extensions[] = {".html", ".html", NULL};
|
||||
char *PHP_HL_extensions[] = {".php", NULL};
|
||||
char *LUA_HL_extensions[] = {".lua", NULL};
|
||||
char *MAN_HL_extensions[] = {".1", ".2", ".3", ".4", ".5", ".6", ".7", ".8", ".man", ".mdoc", ".1b", ".mandoc", NULL};
|
||||
|
||||
|
||||
// 2. Create a list of keywords. Keywords that end in "|" will be given
|
||||
|
@ -100,6 +101,15 @@ char *LUA_HL_keywords[] = {
|
|||
"local|", "not|", "in|", "break|", NULL
|
||||
};
|
||||
|
||||
// Man pages (covers some basic macros)
|
||||
char *MAN_HL_keywords[] = {
|
||||
".cc", ".SH", ".B", ".RB", ".RI", ".IR", ".P", ".nr", ".br", "\\P|",
|
||||
".RS", ".RE", ".TA", ".DS", ".LD", ".DE", ".ID", ".De", ".CD",
|
||||
".BE", ".KS", ".KE", ".KF", ".B1", ".B2", ".FS", ".FE", ".OH", ".EH",
|
||||
".OF", ".EF", ".PT", ".HD", ".BT", ".TH", ".nf", ".fam", ".fi",
|
||||
".TP", NULL
|
||||
};
|
||||
|
||||
static struct editorSyntax HLDB[] = {
|
||||
// 3. Add an entry to the editorSyndax db (this var).
|
||||
// See the C example comments for what each array member
|
||||
|
@ -167,6 +177,15 @@ static struct editorSyntax HLDB[] = {
|
|||
"]]",
|
||||
LUA_HL_keywords,
|
||||
HL_HIGHLIGHT_NUMBERS | HL_HIGHLIGHT_STRINGS
|
||||
},
|
||||
{
|
||||
"man/*roff",
|
||||
MAN_HL_extensions,
|
||||
"\\#",
|
||||
".ig",
|
||||
".end",
|
||||
MAN_HL_keywords,
|
||||
HL_HIGHLIGHT_STRINGS
|
||||
}
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue