daa84 / neovim-gtk

gtk ui for neovim
GNU General Public License v3.0
716 stars 57 forks source link

[Feature] add scroll bar #110

Open hasufell opened 6 years ago

hasufell commented 6 years ago

I've also done some gtk-rs, but this project lacks basic documentation, so I wasn't able to provide a PR in a reasonable time frame.

However, I think a scroll bar is a very crucial and expected feature of an editor gui.

http://gtk-rs.org/docs/gtk/struct.Scrollbar.html https://developer.gnome.org/gtk3/stable/GtkScrollbar.html

daa84 commented 6 years ago

Adding scroll bar is not so easy. It is need somehow listen for scrollbar events from neovim for displayed windows. Second problem is that window can be at the center of two ones. In this case scrollbar must be hidden or somehow painted on top of neovim working area.

There is some plans in neovim to update gui protocol, so it will be possible to separately draw windows. In this case adding scroll bar will be much easier.

hasufell commented 6 years ago

Second problem is that window can be at the center of two ones. In this case scrollbar must be hidden or somehow painted on top of neovim working area.

gvim's behavior is like this:

Very simple and intuitive. So in case the window is in the middle, you just have no scrollbar, only for the windows at the very left and very right.

For huge files, this is really useful.

hasufell commented 4 years ago

I'm currently investigating the options here and have some semi-working things. For this to go forward we need https://github.com/neovim/neovim/pull/11748 to be merged and nvim_win_set_viewport to be added (which doesn't have a PR yet).

The remaining problem then is how to debounce/throttle scrollbar events. They seem to fire too fast and I haven't figured out a simple way to throttle yet, without potentially missing the last scroll event.

My local branch only has one scrollbar, always for the active window. Multiple scrollbars is more involved and I think shouldn't be done at first.