fix(scroll): check mousescroll before spamming

This commit is contained in:
Folke Lemaitre 2024-12-15 08:35:53 +01:00
parent 746f05cf3a
commit 3d67bda1e2
No known key found for this signature in database
GPG key ID: 41F8B1FBACAE2040

View file

@ -204,14 +204,6 @@ function M.check(win)
stats.skipped = stats.skipped + 1
state.current = vim.deepcopy(state.view)
return
elseif spamming and not (state.anim and state.anim.done) then
-- just ignore the scroll when spamming and we're already animating
stats.spamming = stats.spamming + 1
stats.scrolls = stats.scrolls + 1
vim.api.nvim_win_call(win, function()
vim.fn.winrestview(state.current)
end)
return
elseif mouse_scrolling then
if state.anim then
state.anim:stop()
@ -222,6 +214,14 @@ function M.check(win)
stats.mousescroll = stats.mousescroll + 1
state.current = vim.deepcopy(state.view)
return
elseif spamming and not (state.anim and state.anim.done) then
-- just ignore the scroll when spamming and we're already animating
stats.spamming = stats.spamming + 1
stats.scrolls = stats.scrolls + 1
vim.api.nvim_win_call(win, function()
vim.fn.winrestview(state.current)
end)
return
end
stats.scrolls = stats.scrolls + 1