-
Notifications
You must be signed in to change notification settings - Fork 729
Add a Scroll Bar #5304
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
base: master
Are you sure you want to change the base?
Add a Scroll Bar #5304
Conversation
Thanks! I appreciate that it does more than a "regular" scroll bar by adding visual markers for selections. Of course some other text-editors/IDE offer much more with other kinds of markers such as git added/changed/removed lines, or info/warning/error diagnostics. But then you end up with a "3 lanes" scroll bars with a lot of infos which can be confusing. "There's a red mark at the beginning of the buffer : is it red because of git removed lined or red because it's an LSP error?" So here, I think you strike the right balance by only focusing on one of the core principle of Kakoune which is its multi-selections capabilities. |
unfortunately this method causes the scrollbar to potentially have a non-constant height. however this method has the nice property of scrolling the scrollbar past the end of the buffer, just like we do with padding.
Does doc/json_ui.asciidoc need to be updated with the changes to |
While looking over the code, I think this would be best organized as a new method of |
when the wrap highlighter is added, the scroll bar size will reflect how many line numbers are visible. if a wrapped line is effectively taking up a lot of the vertical space in the window, the scroll bar handle will be smaller to reflect that the user is viewing a smaller portion of the file relative to the number of lines in the file.
I've improved the calculation of the size of the scroll bar handle. It works well with the There is still a bug where when scrolling horizontally (which is not possible when the |
A scroll bar that also displays selection lines in the buffer.
This PR adds:
terminal_scroll_bar
toui_options
, which controls whether the scroll bar should show.ScrollBarGutter
andScrollBarHandle
faces describing how to style the gutter and handle. The foreground of these faces will be the color of the characters used to display selection lines.Screenshots
Here is a recording with the default styling and config

Here is a recording with my personal styling and config:

I've tested this with both non-remote and remote clients.
Issues
I am not the biggest fan of the implementation. The computation of
Vector<LineCount> selection_lines
happens on every draw call. This is needed to serialize these locations forRemoteUI
andJsonUI
. This is also computed regardless if the scrollbar is enabled, which is unfortunate.I'm not sure what the appetite for adding something like this is, especially with my implementation. I saw there was a highlighter implementation (#2597) but did not honestly consider it. If we feel like this is best done as a highlighter I can investigate that approach as well.