feat(indent): don't animate indents when new scope overlaps with the previous one, taking white-space into account. See #264

This commit is contained in:
Folke Lemaitre 2024-12-12 11:56:28 +01:00
parent 39c009fe0b
commit 9b4a85905a
No known key found for this signature in database
GPG key ID: 41F8B1FBACAE2040

View file

@ -405,7 +405,11 @@ function M.on_scope(win, buf, scope, prev)
stats.scope = stats.scope + 1
if scope then
scope.win = win
if Snacks.animate.enabled({ buf = buf, name = "indent" }) then
local animate = Snacks.animate.enabled({ buf = buf, name = "indent" })
if prev and (vim.fn.nextnonblank(prev.from) == scope.from) then
animate = false
end
if animate then
step(scope, 0)
Snacks.animate(
0,