Fixed autoreload plugin truncating last character of files with no newline at end

This commit is contained in:
rxi 2020-03-24 19:48:27 +00:00
parent 764b43494e
commit 1e9c3bef1f

View file

@ -18,7 +18,7 @@ local function reload_doc(doc)
local sel = { doc:get_selection() }
doc:remove(1, 1, math.huge, math.huge)
doc:insert(1, 1, text:sub(1, -2))
doc:insert(1, 1, text:gsub("\n$", ""))
doc:set_selection(table.unpack(sel))
update_time(doc)