vdoc: highlight keywords in bright_blue

pull/9325/head
Delyan Angelov 2021-03-16 12:24:34 +02:00
parent 0b0e96a8cd
commit 0c620a78bf
No known key found for this signature in database
GPG Key ID: 66886C0F12D595ED
2 changed files with 3 additions and 9 deletions

View File

@ -152,7 +152,7 @@ fn color_highlight(code string, tb &table.Table) string {
term.yellow('`$tok.lit`') term.yellow('`$tok.lit`')
} }
.keyword { .keyword {
term.blue(tok.lit) term.bright_blue(tok.lit)
} }
.builtin, .symbol { .builtin, .symbol {
term.green(tok.lit) term.green(tok.lit)
@ -243,17 +243,11 @@ fn color_highlight(code string, tb &table.Table) string {
} }
} }
buf.write_string(highlight_code(tok, tok_typ)) buf.write_string(highlight_code(tok, tok_typ))
if prev_prev.kind == .eof { if prev_prev.kind == .eof || prev.kind == .eof || next_tok.kind == .eof {
break break
} }
prev_prev = prev prev_prev = prev
if prev.kind == .eof {
break
}
prev = tok prev = tok
if next_tok.kind == .eof {
break
}
i = tok.pos + tok.len i = tok.pos + tok.len
tok = next_tok tok = next_tok
next_tok = s.scan() next_tok = s.scan()

View File

@ -90,7 +90,7 @@ fn (vd VDoc) gen_plaintext(d doc.Doc) string {
mut pw := strings.new_builder(200) mut pw := strings.new_builder(200)
if cfg.is_color { if cfg.is_color {
content_arr := d.head.content.split(' ') content_arr := d.head.content.split(' ')
pw.writeln('${term.blue(content_arr[0])} ${term.green(content_arr[1])}\n') pw.writeln('${term.bright_blue(content_arr[0])} ${term.green(content_arr[1])}\n')
} else { } else {
pw.writeln('$d.head.content\n') pw.writeln('$d.head.content\n')
} }