Start implementing syntax highlighting optimizations

This commit is contained in:
Zachary Yedidia
2017-02-18 21:28:45 -05:00
parent 18c4196354
commit d0057121ef
4 changed files with 30 additions and 7 deletions

View File

@@ -47,6 +47,7 @@ type Buffer struct {
syntaxDef *highlight.Def
highlighter *highlight.Highlighter
matches []highlight.LineMatch
// Buffer local settings
Settings map[string]interface{}
@@ -189,6 +190,7 @@ func (b *Buffer) UpdateRules() {
if b.highlighter == nil || b.Settings["filetype"].(string) != b.syntaxDef.FileType {
b.Settings["filetype"] = b.syntaxDef.FileType
b.highlighter = highlight.NewHighlighter(b.syntaxDef)
b.matches = b.highlighter.Highlight(b, 0)
}
}