-
Notifications
You must be signed in to change notification settings - Fork 89
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bug: scrolling gets stuck when using mini.animate #761
Comments
After a bit of investigation and debugging on both noice and mini.animate plugins, I found this part of the code to be problematic (although I'm not sure why) : noice.nvim/lua/noice/util/nui.lua Lines 248 to 249 in 0cbe3f8
1) When scrolling is not yet stuck, each of these lines emits a This can be easily tested by displaying the return of 2) When you try to scroll up/down when you're already at the top/bottom of the buffer, only the second line emits a So if the 3) It's the same thing once scrolling gets stuck and you try to scroll in the "right" direction (scroll down when on top / scroll up when on bottom): only the second line still emits an event. Potential FIxes1) I don't understand the point of the second line, which manually triggers a @@ -246,7 +246,6 @@ function M.scroll(win, delta)
vim.defer_fn(function()
vim.api.nvim_buf_call(buf, function()
vim.api.nvim_command("noautocmd silent! normal! " .. top .. "zt")
- vim.api.nvim_exec_autocmds("WinScrolled", { modeline = false })
end)
end, 0)
end 2) By skipping the execution of the two lines if the @@ -243,12 +243,14 @@ function M.scroll(win, delta)
top = math.max(top, 1)
top = math.min(top, M.win_buf_height(win) - info.height + 1)
- vim.defer_fn(function()
- vim.api.nvim_buf_call(buf, function()
- vim.api.nvim_command("noautocmd silent! normal! " .. top .. "zt")
- vim.api.nvim_exec_autocmds("WinScrolled", { modeline = false })
- end)
- end, 0)
+ if info.topline ~= top then
+ vim.defer_fn(function()
+ vim.api.nvim_buf_call(buf, function()
+ vim.api.nvim_command("noautocmd silent! normal! " .. top .. "zt")
+ vim.api.nvim_exec_autocmds("WinScrolled", { modeline = false })
+ end)
+ end, 0)
+ end
end
return M |
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 7 days. |
Did you check docs and existing issues?
Neovim version (nvim -v)
0.9.5
Operating system/version
macOS 14.0 (23A344)
Describe the bug
If the mini.animate plugin is loaded and the scroll animation is enabled (which is the default config), the hover/signature window scrolling will get stuck if you try to scroll up/down when the window is already displaying the top/bottom of the buffer.
See the attached video.
stuck.mp4
Steps To Reproduce
mini.animate
plugin and call its setup method without any argument. Add and configure an LSP server (in this example lua_lsp) and a few keymaps to interact with the hover window (see details below).K
key in normal mode in my case) then userequire("noice.lsp").scroll
with a negative number as argument (by pressing<C-b>
in my case). The scrolling is now stuck on this window, you can't scroll down anymore (by pressing<C-f>
in my case).K
key in normal mode in my case) then userequire("noice.lsp").scroll
until the last line of the buffer is displayed (by pressing<C-f>
several times in my case) then press<C-f>
one more time. The scrolling is now stuck on this window, you can't scroll up anymore (by pressing<C-b>
in my case).Expected Behavior
The hover/signature window should not get stuck.
Repro
The text was updated successfully, but these errors were encountered: