mirror of
https://github.com/zoriya/virtcolumn.nvim.git
synced 2026-06-06 02:11:54 +00:00
improve: use a shorter delay when the total lines is changed
This commit is contained in:
@@ -106,7 +106,15 @@ local function refresh(args)
|
|||||||
textchanged_timer:stop()
|
textchanged_timer:stop()
|
||||||
textchanged_timer:close()
|
textchanged_timer:close()
|
||||||
end
|
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
|
else
|
||||||
_refresh()
|
_refresh()
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user