Don't rehighlight if there are no modifications

This commit is contained in:
Zachary Yedidia
2020-01-28 17:15:02 -05:00
parent d965e8de4f
commit d74f40882d
3 changed files with 15 additions and 11 deletions

View File

@@ -278,7 +278,7 @@ func NewBuffer(r io.Reader, size int64, path string, startcursor Loc, btype BufT
screen.TermMessage(err)
}
b.Modifications = make([]Loc, 10)
b.Modifications = make([]Loc, 0, 10)
OpenBuffers = append(OpenBuffers, b)
@@ -615,6 +615,7 @@ func (b *Buffer) UpdateRules() {
b.Highlighter = highlight.NewHighlighter(b.SyntaxDef)
if b.Settings["syntax"].(bool) {
b.Highlighter.HighlightStates(b)
b.Highlighter.HighlightMatches(b, 0, b.End().Y)
}
}
}