Subject: Re: bug#72323: 31.0.50; line-move unconditionally resets vscroll to 0

From: Steven Allen <[email-masked]>
Date: Sun, 18 Aug 2024 10:38:29 -0700

Eli Zaretskii <[email-masked]> writes:

>> From: Steven Allen <[email-masked]>
>> Cc: [email-masked], [email-masked]
>> Date: Sun, 28 Jul 2024 13:07:09 -0700
>> 
>> Eli Zaretskii <[email-masked]> writes:
>> 
>> > vscroll is not just about scrolling the window.  It is basically a
>> > vertical offset from the screen line that shows window-start to the
>> > top-most pixel shown in the window.  It is meant to enable to see the
>> > tall screen line at window-start in its entirety.  Once point moves
>> > off that screen line, vscroll is no longer pertinent, since the
>> > important line, for which vscroll has been determined, has changed.
>> > For example, imagine that the line into which point moves cannot be
>> > displayed in its entirety with this vscroll, because it starts at a
>> > different vertical coordinate (so its lower part could be below the
>> > window bottom).
>> 
>> No? E.g., if I have half a line (or half an image) visible and move my
>> point off that line, I wouldn't expect that line to suddenly scroll out
>> of view _unless_ the entire screen needs to scroll because the
>> text/image is larger than the entire screen.
>
> It depends on the details of the line from which you move cursor and
> the one into which you move.  For example, if the former takes up
> almost the entire window, then moving into the next one could cause
> that next line to be only partially visible, and that is unacceptable
> for the Emacs redisplay.

In that case I completely agree. If point moves to a partially displayed
line, vscroll needs to be adjusted and/or reset.

> Once again: the vscroll value is pertinent only for the screen line
> for which it was computed, because the way it is computed uses the
> metrics of that line.  Once you move to another line, the value is no
> longer pertinent.

Let's be precise about "move to another line":

- When window-start changes, vscroll becomes invalid because the lines at
  the top of the screen (to which vscroll applies) has changed. I agree
  that it must be reset in this case.
- When point is moved up and down in such a way that window-start isn't
  changed, vscroll is still perfectly valid as the top line in the
  window hasn't changed. vscroll is relative to the top line, not point.

> Emacs supports smooth scrolling only within a single screen line, and
> that uses vscroll.  That's the original design intent of vscroll.
> Smooth scrolling between lines is not really supported.
> pixel-scrolling attempts to solve that, and does it well, but it does
> have some problematic corners.  Those corners need to be solved inside
> pixel-scroll code.

Honestly, scrolling between lines is working perfectly. I'm not running
into issues when scrolling, I'm running into issues when changing lines
after partially scrolling a line.