From e115855491ef0fd30eae7462f9ded2e5bab6c033 Mon Sep 17 00:00:00 2001 From: "Luke I. Wilson" Date: Sun, 4 Apr 2021 11:09:34 -0500 Subject: [PATCH] TextEdit highlighting: update lang definition --- ui/textedit.go | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/ui/textedit.go b/ui/textedit.go index 734634c..64b5b83 100644 --- a/ui/textedit.go +++ b/ui/textedit.go @@ -98,17 +98,20 @@ loop: &buffer.RegexpRegion{Start: regexp.MustCompile("\\/\\/.*")}: buffer.Comment, &buffer.RegexpRegion{Start: regexp.MustCompile("\".*?\"")}: buffer.String, &buffer.RegexpRegion{ - Start: regexp.MustCompile("\\b(var|const|if|else|range|for|switch|case|go|func|return|defer|import|type|package)\\b"), + Start: regexp.MustCompile("\\b(var|const|if|else|range|for|switch|fallthrough|case|default|break|continue|go|func|return|defer|import|type|package)\\b"), }: buffer.Keyword, &buffer.RegexpRegion{ - Start: regexp.MustCompile("\\b(int|byte|string|bool|struct)\\b"), + Start: regexp.MustCompile("\\b(u?int(8|16|32|64)?|rune|byte|string|bool|struct)\\b"), }: buffer.Type, &buffer.RegexpRegion{ Start: regexp.MustCompile("\\b([1-9][0-9]*|0[0-7]*|0[Xx][0-9A-Fa-f]+|0[Bb][01]+)\\b"), }: buffer.Number, &buffer.RegexpRegion{ - Start: regexp.MustCompile("\\b(len|cap|panic)\\b"), + Start: regexp.MustCompile("\\b(len|cap|panic|make|copy|append)\\b"), }: buffer.Builtin, + &buffer.RegexpRegion{ + Start: regexp.MustCompile("\\b(nil|true|false)\\b"), + }: buffer.Special, }, } @@ -120,6 +123,7 @@ loop: buffer.Type: tcell.Style{}.Foreground(tcell.ColorPurple).Background(tcell.ColorBlack), buffer.Number: tcell.Style{}.Foreground(tcell.ColorFuchsia).Background(tcell.ColorBlack), buffer.Builtin: tcell.Style{}.Foreground(tcell.ColorBlue).Background(tcell.ColorBlack), + buffer.Special: tcell.Style{}.Foreground(tcell.ColorFuchsia).Background(tcell.ColorBlack), } t.Highlighter = buffer.NewHighlighter(t.Buffer, lang, colorscheme)