Open khughitt opened 4 years ago
Thanks for all the feedback, it is very helpful
Vim allows the scrollwheel to scroll inactive windows without activating them. The scrollbar floating window is an always-inactive floating window, and so it gets scrolled by the wheel. The plugin currently attempts to prevent this by patching <ScrollWheelUp>
to run SBRedrawScrollbar()
after scrolling, but as you can see it is not detected reliably.
The main problem is that I don't know of a straightforward way to detect the particular window where the mouse is when a scrollevent occurs, or to detect the window that the scrollwheel event occurs in. Remaping <ScrollWheelUp>
or responding to autocmd events will not change the values returned by nvim_get_current_[win|buf|etc]
functions.
I'm a bit busy right now but I will look into it when I have more time. A couple possible paths forward
nvim_buf_lines_event
using channels. From the docs it looks like this could be used to detect scrolling events in a buffer-specific manner. This would then allow for a proper response to the mousewheel event in scrollbar floating window. A side bonus would be also using this as the scroll detection mechanism in the main text window, so that movement keys not longer need to be patched. Disclaimer, I don't know how to use channels so I don't know if my reading of the docs is correct.Suggestions welcome
No problem! Unfortunately I don't know enough about Neovim's internal plugin API to really offer help here.. It's not the most urgent issue though, so I can live without mousewheel support for now and we can just keep the issue open to keep track of it. If I ever get around to learning how to write plugins, perhaps I can come back to this and take a stab then.
Greetings!
First off, thank you for creating this great plugin, and for taking the time to document and share it! Already it is much better than any of the previous solutions I've attempted to use in the past.
I'm testing it out now with my current config, and have come across a few small problems that I will report as issues.
One issue I noticed is that the mousewheel works as expected, and the scrollbar updates properly, when the cursor is over the main body of neovim, but not when the mouse is held over the narrow scrollbar region. Attempting to use the mousewheel above the scrollbar causes the bar itself to jump around dramatically, while the document itself is unchanged.
I realize that there are some issues with Neovim's mouse support that may be related to this, but I figured it would still be good to keep track of.
One final thought -- you might consider sharing the plugin on r/neovim, if you haven't already. I'm sure others would find it useful and you might get some good feedback there as well.
Cheers, Keith
System info:
Neovim version: