ReHighlightLine will rehighlight the state and match for a single line
(input LineStates, lineN int)
| 384 | |
| 385 | // ReHighlightLine will rehighlight the state and match for a single line |
| 386 | func (h *Highlighter) ReHighlightLine(input LineStates, lineN int) { |
| 387 | input.Lock() |
| 388 | defer input.Unlock() |
| 389 | |
| 390 | line := input.LineBytes(lineN) |
| 391 | highlights := make(LineMatch) |
| 392 | |
| 393 | h.lastRegion = nil |
| 394 | if lineN > 0 { |
| 395 | h.lastRegion = input.State(lineN - 1) |
| 396 | } |
| 397 | |
| 398 | var match LineMatch |
| 399 | if lineN == 0 || h.lastRegion == nil { |
| 400 | match = h.highlightEmptyRegion(highlights, 0, true, lineN, line, false) |
| 401 | } else { |
| 402 | match = h.highlightRegion(highlights, 0, true, lineN, line, h.lastRegion, false) |
| 403 | } |
| 404 | curState := h.lastRegion |
| 405 | |
| 406 | input.SetMatch(lineN, match) |
| 407 | input.SetState(lineN, curState) |
| 408 | } |
nothing calls this directly
no test coverage detected