fix(indent): do animate check in bufcall

This commit is contained in:
Folke Lemaitre 2024-12-19 08:47:08 +01:00
parent d2fafff5f3
commit c62e7a2561
No known key found for this signature in database
GPG key ID: 41F8B1FBACAE2040

View file

@ -420,10 +420,12 @@ function M.on_scope(win, buf, scope, prev)
scope.win = win
local animate = Snacks.animate.enabled({ buf = buf, name = "indent" })
-- skip animation if new lines have been added before or inside the scope
if prev and (vim.fn.nextnonblank(prev.from) == scope.from) then
animate = false
end
vim.api.nvim_buf_call(buf, function()
-- skip animation if new lines have been added before or inside the scope
if prev and (vim.fn.nextnonblank(prev.from) == scope.from) then
animate = false
end
end)
if animate then
step(scope, 0)