Subject: Re: bug#46316: 27.1; wrong horizontal scroll with truncate-lines value t

From: [email-masked]
Date: Mon, 15 Feb 2021 00:43:32 +0900

Eli Zaretskii <[email-masked]> writes:

>> Regarding image-mode, a simpler example of the bug is written as below.
>> The hscroll does not change when the buffer is changed.
>> Image display, window focus or message is not related.
>> 
>> (let ((buf (generate-new-buffer "tmp")))
>>   (switch-to-buffer buf)
>>   (setq truncate-lines t)
>>   (dotimes (i 200)
>>     (insert (format ":%03d" i))
>>     (when (= 0 (% (1+ i) 100)) (insert ?\n)))
>>   (forward-char -1)
>>   (sit-for 1)
>>   (set-window-hscroll nil (window-hscroll))
>>   (save-excursion
>>     (forward-char -100)
>>     (insert-char ?\n 10)
>>     ))
>
> Sorry, I don't think I follow: what exactly is the bug here?  What did
> you expect to happen ,and what did actually happen?

The expression '(set-window-hscroll nil (window-hscroll))' should not
have any effect, but if it is deleted from the form, auto-hscroll-mode
works correctly.

Not only point motion but also buffer modification should be checked for
auto-hscroll-mode.