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
Horizontal scroll bar is far wider than longest line in the file #886
Comments
Correct. The editing widget we use does not measure the length of lines to determine the width of the longest line since that would require laying out and measuring the entire file instead of only the visible area. So it tracks the longest line that it has displayed and sets the scroll bar for that, but it starts with an initial guesstimate of 2000 pixels, which might be about 300 chars depending on your font size. |
any way of reducing/configuring the guesstimate? |
The widget can be told what to use, but "somebody" has to write the code to do it (and possibly the UI to set the preference). |
Why is "somebody" in quotes? If anyone wants to implement this, it would be most welcome, IMO. |
Well, it's easy enough to implement naively, and I gave it a shot for fun: https://github.com/b4n/geany-auto-scroll-width. It's a little more tricky to auto-hide the bottom scrollbar, but also doable. But getting a version with zero performance impact would probably be a lot harder to do, and I guess would require altering Scintilla itself to store layout length in the line data itself, plus a global per-document value, and only re-compute the max width when the line changed width and had the largest width (if new width is larger, just update using this new value, instead find the new largest). |
Ah, and I honestly don't see what real value it adds. Visual clue to how long is the longest line? I hardly see a use case for this. But well, so long as it doesn't negatively impact me I don't care if it works :) |
@codebrainz because its traditional (TM Enrico) :) @b4n, don't use on large files, |
@elextr I know, laying out the whole file is the very problem of this :) and probably the very reason it's not built in Scintilla already. |
It wastes 20 or whatever pixels for no good reason is one issue. I generally keep the window wide enough that my ~80 chars of code would fit, so not only showing a really long scrollbar wastes vertical screen space but it makes me think I screwed up and have a really long line. Also the scroll thumb doesn't actually reflect the width of the lines properly so it's even more misleading. I can always tell if an editor is using Scintilla by whether it has broken/buggy horizontal scrollbar :)
I tend to agree it should be added to Scintilla proper, turned off by default. Then editors could choose whether to have a broken scrollbar, or to enable to fix if a file is under a certain size or whatever. |
At least in SciTE there's
property to do this (http://www.scintilla.org/SciTEDoc.html). Is this done purely in SciTE code or is there some native support in Scintilla for this feature that we could use? (Haven't checked myself.) |
@techee I assume it uses SCI_SETSCROLLWIDTHTRACKING, which only makes the situation worse since it never shrinks the scrollbar smaller, making it even more confusing when looking at the scrollbar as some kind of indication of how far horizontal scroll is. I never actually looked at SciTE code to see if it does something smarter. |
@techee @codebrainz and we set SCROLLWIDTHTRACKING on, hard coded. |
I just want to add my +1 to this. It's a bit annoying when you have a fixed column width set, so you'll never have any characters going beyond that limit. I'm coming from gedit, which does not have this issue. |
Doesnt that mean we can simply reduce the initial estimate and then it'll be better fit, and it will work for cases where the estimate is wrong? Why not just set the estimate to, like, 120 chars then? |
Why on the monitor resolution? |
Font size is in points, which is 1/72th of an inch, so varying DPI of the monitor makes the pixels per character different even for the same font size. |
I see. So let's measure the width (pixels) of the M or W character and use that. For monospace fonts (common case) it doesn't matter, and for others it's a defensive default. |
l'm using a touchpad and changed the synaptics configuration that l can scroll horizontally.
Can l somehow disable horizontal scrolling? |
@HybridDog you can turn on Line Wrapping which will disable horizontal scrolling. |
Thanks, it works after restarting. |
How about showing the horizontal scroll bar only when there are lines which scroll right? And yes, it would be wonderful if the horizontal scroll bar would scroll as far right as the longest line in the file. |
@LadyAleena unfortunately Scintilla does not track the length of lines not on screen so as to avoid having to perform layout on the whole file, therefore it can't know when horizontal scrolling is needed. |
Notepad++, also based on Scintilla, does it well. |
With geany 1.24.1. Pretty much any file, even if it has a maximum line length of 80 characters - the horizontal scroll bar is about 300 characters wide, so it's hard to tell if there's a very long line in the file without actually examining each line.
The text was updated successfully, but these errors were encountered: