fix(scroll): don't animate invalid windows

This commit is contained in:
Folke Lemaitre 2024-12-11 20:50:44 +01:00
parent 8c2410c2de
commit 41ca13d119
No known key found for this signature in database
GPG key ID: 41F8B1FBACAE2040

View file

@ -221,6 +221,9 @@ function M.check(win)
local to_virtcol = vim.fn.virtcol({ state.target.lnum, state.target.col }, false, win)
state.anim = Snacks.animate(0, scrolls, function(value, ctx)
if not vim.api.nvim_win_is_valid(win) then
return
end
vim.api.nvim_win_call(win, function()
scroll(value - ctx.prev)