Subject: bug#68786: 30.0.50; Horizontal overscroll

From: Eli Zaretskii <[email-masked]>
Date: Mon, 29 Jan 2024 14:02:08 +0200

> From: Andrey Listopadov <[email-masked]>
> Date: Sun, 28 Jan 2024 23:41:57 +0300
> 
> However, when scrolling to the right with the touchpad (to avoid
> confusion view goes to the right and the text goes to the left), we can
> do this:
> 
> |_____________Emacs____________|
> |ation.                        |
> |ts buffer.                    |
> |                              |
> |                              |
> |                              |
> |______________________________|
> |-------------------------=====|
> |______________________________|
> 
> The scrollbar itself doesn't allow us to go beyond the longest text
> visible text.  Scrolling with the touchpad, however, allows for this.
> We can even do this:
> 
> |_____________Emacs____________|
> |                              |
> |                              |
> |                              |
> |                              |
> |                              |
> |______________________________|
> |----------------------------==|
> |______________________________|
> 
> Or even this:
> 
> |_____________Emacs____________|
> |                              |
> |                              |
> |                              |
> |                              |
> |                              |
> |______________________________|
> |-----------------------------=|
> |______________________________|
> 
> The text is so far left, that the draggable portion of the scrollbar no
> longer shrinks.

The above can also be done with horizontal scroll bar, if instead of
dragging the scroll-bar's "thumb" you click on the arrow at the right
side of the scroll bar.  At least it works here (perhaps this depends
on the toolkit, I don't know).

So I think the inconsistency is much smaller than you think, and we
should stop right here and talk about why this makes you uncomfortable
or requires any changes in your opinion.  I personally find nothing
bad or unexpected with the ability to scroll past the last visible
character: after all, if the user doesn't want that, he/she can avoid
scrolling farther than he/she wants.

It is true that most other applications don't vary the thumb size, but
Emacs has always behaved like it does, so changing it to follow the
other apps is not an option at this point, at least not by default.

Having said that, ...

> I would like to ask for a feature to limit the horizontal scroll by the
> longest line, much like the horizontal scrollbar works by default. It
> may not be the longest line in the buffer, as calculating this for huge
> buffers is probably too impactful unless we can cache the longest line
> length until the buffer is changed.  Or maybe Emacs already knows the
> buffer's "dimensions", I don't know.

... I won't object to such a feature, provided that it's optional and
OFF by default, and also that it is supported on as many toolkits as
is practical.  Patches welcome.