From 8477818c96a4de092353488ca005c263c581138d Mon Sep 17 00:00:00 2001 From: Francesco Abbate Date: Thu, 7 Oct 2021 19:03:16 +0200 Subject: [PATCH] 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. --- data/core/doc/highlighter.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/data/core/doc/highlighter.lua b/data/core/doc/highlighter.lua index e7650d01..72fba793 100644 --- a/data/core/doc/highlighter.lua +++ b/data/core/doc/highlighter.lua @@ -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