Add `soft_reset` to highlighter
This allows clearing the `lines` table without removing entries.
This commit is contained in:
parent
a7bbd3d6f7
commit
f24aa64cd5
|
@ -40,6 +40,13 @@ end
|
||||||
|
|
||||||
function Highlighter:reset()
|
function Highlighter:reset()
|
||||||
self.lines = {}
|
self.lines = {}
|
||||||
|
self:soft_reset()
|
||||||
|
end
|
||||||
|
|
||||||
|
function Highlighter:soft_reset()
|
||||||
|
for i=1,#self.lines do
|
||||||
|
self.lines[i] = false
|
||||||
|
end
|
||||||
self.first_invalid_line = 1
|
self.first_invalid_line = 1
|
||||||
self.max_wanted_line = 0
|
self.max_wanted_line = 0
|
||||||
end
|
end
|
||||||
|
|
|
@ -47,7 +47,7 @@ function Doc:reset_syntax()
|
||||||
local syn = syntax.get(self.filename or "", header)
|
local syn = syntax.get(self.filename or "", header)
|
||||||
if self.syntax ~= syn then
|
if self.syntax ~= syn then
|
||||||
self.syntax = syn
|
self.syntax = syn
|
||||||
self.highlighter:reset()
|
self.highlighter:soft_reset()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue