Fix error in incremental syntax highlighter

In the highlither thread We should accept a previously generated line tokenization
past first_invalid_line only if the text is the same. The text can change because of
insert or remove operations.

Close #573.
This commit is contained in:
Francesco Abbate 2021-10-07 19:03:16 +02:00
parent 9fb166d3cc
commit 7a435a568a
1 changed files with 1 additions and 1 deletions

View File

@ -24,7 +24,7 @@ function Highlighter:new(doc)
for i = self.first_invalid_line, max do
local state = (i > 1) and self.lines[i - 1].state
local line = self.lines[i]
if not (line and line.init_state == state) then
if not (line and line.init_state == state and line.text == self.doc.lines[i]) then
self.lines[i] = self:tokenize_line(i, state)
end
end