Subject: bug#57343: hscroll current-line scrolls short lines too far to the left

From: Stephen Berman <[email-masked]>
Date: Tue, 23 Aug 2022 18:56:34 +0200

On Tue, 23 Aug 2022 16:13:27 +0300 Eli Zaretskii <[email-masked]> wrote:

>
>> From: Erik van Zwol <[email-masked]>
>> Date: Sun, 21 Aug 2022 22:03:29 -0600
>>
>> starting from 'emacs -Q':
>> Toggle-truncate-lines (so that long lines are truncated)
>> Evaluate the following:
>> (setq auto-hscroll-mode 'current-line)
>> (setq hscroll-margin 5)
>> (setq hscroll-step 1)
>> Insert enough text such that the line starts to hscroll
>> On the line directly below, insert enough text to fill about half the
>> width of the frame
>> Move point to the long line near the end (must be hscrolling the single
>> line)
>> Move point down to the next line, it should hscroll even though it does
>> not need to
>> See the animated gifs on this post:
>> https://www.reddit.com/r/emacs/comments/wgef0b/looking_for_better_alternative_to_autohscrollmode/
>>
>> I have attached a patch that I think fixes the issue.  Please tell me
>> how to proceed, and what other information you need.
>
> Thanks.
>
> I feel there's something else at work here, because if you move the
> cursor up instead of down (i.e., to the previous instead of the next
> line), the problem doesn't happen.

I see the same hscrolling when moving to the next and to the previous
line, both the same length (too short for hscrolling), see the attached
screenshots.

Steve Berman