Skip to content
This repository has been archived by the owner on Dec 10, 2023. It is now read-only.

Commit

Permalink
color bolding
Browse files Browse the repository at this point in the history
  • Loading branch information
MorganPeterson committed Jan 13, 2022
1 parent bf53bc9 commit 581c2a8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
10 changes: 6 additions & 4 deletions src/syntax.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ char *C_HL_keywords[] = {
"int|", "int32_t|", "int8_t|", "int64_t|", "long|", "double|", "float|",
"char|", "unsigned|", "signed|", "void|", "#include|", "#define|", "auto",
"const", "short|", "default", "register", "sizeof|", "volatile|", "goto|",
"do", "extern", NULL };
"do", "extern", NULL};

char *JS_HL_keywords[] = {
"abstract", "async", "await", "boolean", "break", "byte", "case", "catch",
Expand All @@ -33,7 +33,7 @@ char *JS_HL_keywords[] = {
"new", "null", "of", "package", "private", "protected", "public", "return",
"set", "short", "static", "super", "switch", "synchronized", "this",
"throw", "throws", "transient", "true", "try", "typeof", "var", "void",
"volatile", "while", "with", "yield", NULL };
"volatile", "while", "with", "yield", NULL};

char *GO_HL_keywords[] = {"break", "case", "chan", "const", "continue",
"default", "defer", "else", "fallthrough", "for", "func", "go", "goto", "if",
Expand All @@ -43,13 +43,13 @@ char *GO_HL_keywords[] = {"break", "case", "chan", "const", "continue",
"int16", "int32", "int64", "rune", "string", "uint", "uint8", "uint16",
"uint32", "uint64", "uintptr", "append", "cap", "close", "complex", "copy",
"delete", "imag", "len", "make", "new", "panic", "print", "println", "real",
"recover", NULL };
"recover", NULL};

char *SH_HL_keywords[] = {"if", "then", "elif", "else", "fi", "case",
"in", "esac", "while", "for", "do", "done", "continue", "local", "return",
"select", "-a", "-b", "-c", "-d", "-e", "-f", "-g", "-h", "-k", "-p", "-r",
"-s", "-t", "-u", "-w", "-x", "-O", "-G", "-L", "-S", "-N", "-nt", "-ot",
"-ef", "-o", "-z", "-n", "-eq", "-ne", "-lt", "-le", "-gt", "-ge", NULL };
"-ef", "-o", "-z", "-n", "-eq", "-ne", "-lt", "-le", "-gt", "-ge", NULL};

syntax_t HLDB[] = {
{
Expand Down Expand Up @@ -128,6 +128,7 @@ parse_text(buffer_t *b, int32_t p)
return state;

if ((state == HL_KEYWORD || state == HL_KEYWORD2) && is_separator(*now)) {
attroff(A_BOLD);
next_state = state = HL_NORMAL;
}

Expand Down Expand Up @@ -210,6 +211,7 @@ parse_text(buffer_t *b, int32_t p)
if (kw2)
klen--;
if (!strncmp((char*)now, kyw[j], klen) && is_separator(*(now + klen))) {
attron(A_BOLD);
if (kw2)
return (next_state = HL_KEYWORD);
return (next_state = HL_KEYWORD2);
Expand Down
3 changes: 1 addition & 2 deletions src/themes.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,5 @@ init_colors(void)
init_pair(HL_MLCOMMENT, colors[DARKGREY].eightbit, colors[WHITE].eightbit);
init_pair(HL_MODELINE, colors[NAVY].eightbit, colors[OFFWHITE].eightbit);
init_pair(HL_KEYWORD, colors[PINK].eightbit, colors[WHITE].eightbit);
init_pair(HL_KEYWORD2, colors[DARKRED].eightbit, colors[WHITE].eightbit);
init_pair(HL_KEYWORD2, colors[PURPLE].eightbit, colors[WHITE].eightbit);
}

0 comments on commit 581c2a8

Please sign in to comment.