fix(dim): check that win is valid when animating dim. Closes #1342

This commit is contained in:
Folke Lemaitre 2025-02-20 17:17:16 +01:00
parent 6afb8debd6
commit 47e1440d54
No known key found for this signature in database
GPG key ID: 41F8B1FBACAE2040

View file

@ -110,7 +110,7 @@ function M.enable(opts)
end
Snacks.animate(scopes_anim[win].from, scope.from, function(v)
if not scopes_anim[win] then
if not scopes_anim[win] or not vim.api.nvim_win_is_valid(win) then
return
end
scopes_anim[win].from = v
@ -118,7 +118,7 @@ function M.enable(opts)
end, vim.tbl_extend("keep", { int = true, id = "snacks_dim_from_" .. win, buf = buf }, opts.animate))
Snacks.animate(scopes_anim[win].to, scope.to, function(v)
if not scopes_anim[win] then
if not scopes_anim[win] or not vim.api.nvim_win_is_valid(win) then
return
end
scopes_anim[win].to = v