Pre-populate the highlighter
This avoids problems with calls to `[insert,remove]_notify` on lines that the highlighter has not yet added.
This commit is contained in:
parent
f24aa64cd5
commit
d0a2c913f5
|
@ -62,12 +62,15 @@ function Doc:load(filename)
|
|||
local fp = assert( io.open(filename, "rb") )
|
||||
self:reset()
|
||||
self.lines = {}
|
||||
local i = 1
|
||||
for line in fp:lines() do
|
||||
if line:byte(-1) == 13 then
|
||||
line = line:sub(1, -2)
|
||||
self.crlf = true
|
||||
end
|
||||
table.insert(self.lines, line .. "\n")
|
||||
self.highlighter.lines[i] = false
|
||||
i = i + 1
|
||||
end
|
||||
if #self.lines == 0 then
|
||||
table.insert(self.lines, "\n")
|
||||
|
|
Loading…
Reference in New Issue