Skip to content

Commit

Permalink
fix(indent): do animate check in bufcall
Browse files Browse the repository at this point in the history
  • Loading branch information
folke committed Dec 19, 2024
1 parent d2fafff commit c62e7a2
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions lua/snacks/indent.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit c62e7a2

Please sign in to comment.