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") )
|
local fp = assert( io.open(filename, "rb") )
|
||||||
self:reset()
|
self:reset()
|
||||||
self.lines = {}
|
self.lines = {}
|
||||||
|
local i = 1
|
||||||
for line in fp:lines() do
|
for line in fp:lines() do
|
||||||
if line:byte(-1) == 13 then
|
if line:byte(-1) == 13 then
|
||||||
line = line:sub(1, -2)
|
line = line:sub(1, -2)
|
||||||
self.crlf = true
|
self.crlf = true
|
||||||
end
|
end
|
||||||
table.insert(self.lines, line .. "\n")
|
table.insert(self.lines, line .. "\n")
|
||||||
|
self.highlighter.lines[i] = false
|
||||||
|
i = i + 1
|
||||||
end
|
end
|
||||||
if #self.lines == 0 then
|
if #self.lines == 0 then
|
||||||
table.insert(self.lines, "\n")
|
table.insert(self.lines, "\n")
|
||||||
|
|
Loading…
Reference in New Issue