edit icon indicating copy to clipboard operation
edit copied to clipboard

Add a horizontal scrollbar

Open tstndeemkssz opened this issue 7 months ago • 3 comments

Being able to scroll horizontally by dragging a scrollbar may assist with reading code.

Image

tstndeemkssz avatar May 20 '25 01:05 tstndeemkssz

This seems like a case where word wrapping (Alt+Z) would help! Is that enough to get you unblocked for now?

DHowett avatar May 20 '25 02:05 DHowett

The primary problem with horizontal scrollbars is that this requires measuring the length of the lines of the entire file which is of course slow if the file is very large. Worse yet, it requires us to keep track of the length of each line, because shortening the longest may result in the 2nd longest line to be the longest now. The question then is: How do you know which line was the 2nd longest and how long was it?

Merely showing a horizontal scrollbar for only the lines in the viewport would be a lot simpler though. (But this means the scrollbar would shift as you scroll through the document.)

lhecker avatar May 20 '25 16:05 lhecker

CLI text editors often scroll (overlong) lines and display a wrap marker instead of scrolling the viewport. While it is jarring compared to the GUI-native paradigm of scrolling the viewport, you can see why it's done this way as it solves all of these issues (only measures displayed lines, no shifting scrollbar). Here's nano:

https://github.com/user-attachments/assets/46fcd3f2-9c97-4d6b-a71c-4ff5a1a845d8

stianhoiland avatar May 20 '25 23:05 stianhoiland