Fix bug where nvim_lecho causes tables to grow infinitely

pull/3/head release/0.3.1
Iron-E 4 years ago
parent e285be6ff6
commit a9acffeb3c
No known key found for this signature in database
GPG Key ID: 19B71B7B7B021D22

@ -74,10 +74,8 @@ end
* `hlTables` => the tables to echo with highlights.
]]
---------------------------------
local resetHighlight = Entry.new('None', '')
function api.nvim_lecho(hlTables)
api.nvim_redraw()
hlTables[#hlTables + 1] = resetHighlight
for _, hlTable in ipairs(hlTables) do
-- `:echohl` the hlgroup and then `:echon` the string
api.nvim_command(
@ -85,6 +83,7 @@ function api.nvim_lecho(hlTables)
.. " | echon '" .. tostring(hlTable['str']) .. "'"
)
end
api.nvim_command('echohl None')
end
--------------------------

Loading…
Cancel
Save