+
+// ReHighlightLine will rehighlight the state and match for a single line
+func (h *Highlighter) ReHighlightLine(input LineStates, lineN int) {
+ line := []rune(input.Line(lineN))
+ highlights := make(LineMatch)
+
+ h.lastRegion = nil
+ if lineN > 0 {
+ h.lastRegion = input.State(lineN - 1)
+ }
+
+ var match LineMatch
+ if lineN == 0 || h.lastRegion == nil {
+ match = h.highlightEmptyRegion(highlights, 0, true, lineN, line, false)
+ } else {
+ match = h.highlightRegion(highlights, 0, true, lineN, line, h.lastRegion, false)
+ }
+ curState := h.lastRegion
+
+ input.SetMatch(lineN, match)
+ input.SetState(lineN, curState)
+}