improve: use a shorter delay when the total lines is changed

This commit is contained in:
wongxy
2022-04-15 12:34:45 +08:00
parent 5f3d32910b
commit 348beb3ab2
+9 -1
View File
@@ -106,7 +106,15 @@ local function refresh(args)
textchanged_timer:stop()
textchanged_timer:close()
end
textchanged_timer = vim.defer_fn(_refresh, 500)
local lines_count = vim.fn.line "$"
local delay
if lines_count ~= vim.b.virtcolumn_lines_count then
vim.b.virtcolumn_lines_count = lines_count
delay = 50
else
delay = 500
end
textchanged_timer = vim.defer_fn(_refresh, delay)
else
_refresh()
end