mirror of
https://github.com/zyedidia/micro.git
synced 2026-02-04 22:20:20 +09:00
Fix end line number in HighlightMatches (#1662)
There is a bit of mess in the usage of HighlightMatches: in some places we assume that it updates lines from startline to endline inclusive, in other places we assume it's non-inclusive. This fix makes it always inclusive. In particular, it fixes a bug: when we open a file which has no newline at the end, the last line isn't highlighted.
This commit is contained in:
@@ -336,11 +336,11 @@ func (h *Highlighter) HighlightStates(input LineStates) {
|
||||
}
|
||||
}
|
||||
|
||||
// HighlightMatches sets the matches for each line in between startline and endline
|
||||
// HighlightMatches sets the matches for each line from startline to endline
|
||||
// It sets all other matches in the buffer to nil to conserve memory
|
||||
// This assumes that all the states are set correctly
|
||||
func (h *Highlighter) HighlightMatches(input LineStates, startline, endline int) {
|
||||
for i := startline; i < endline; i++ {
|
||||
for i := startline; i <= endline; i++ {
|
||||
if i >= input.LinesNum() {
|
||||
break
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user