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:
Guldoman 2021-11-20 01:18:37 +01:00
parent f24aa64cd5
commit d0a2c913f5
No known key found for this signature in database
GPG Key ID: C08A498EC7F1AFDD
1 changed files with 3 additions and 0 deletions

View File

@ -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")