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

@@ -358,8 +358,9 @@ func (h *Highlighter) HighlightMatches(input LineStates, startline, endline int)
}
// ReHighlightStates will scan down from `startline` and set the appropriate end of line state
// for each line until it comes across the same state in two consecutive lines
func (h *Highlighter) ReHighlightStates(input LineStates, startline int) {
// for each line until it comes across a line whose state does not change
// returns the number of the final line
func (h *Highlighter) ReHighlightStates(input LineStates, startline int) int {
// lines := input.LineData()
h.lastRegion = nil
@@ -382,9 +383,11 @@ func (h *Highlighter) ReHighlightStates(input LineStates, startline int) {
input.SetState(i, curState)
if curState == lastState {
break
return i
}
}
return input.LinesNum() - 1
}
// ReHighlightLine will rehighlight the state and match for a single line