Subject: bug#29002: it.first_visible_x is erroneously 0 while horizontal scrolling.

From: Keith David Bershatsky <[email-masked]>
Date: Sun, 29 Oct 2017 13:12:15 -0700

Horizontal scroll bars are not visible in this example.  I have been using the horizontal mouse-wheel.  I can reproduce the issue by evaluating (scroll-right 1) in the minibuffer when at the end of a long-line, and then pressing the left arrow-key, and then calling F5 (bound to bug-hscroll).

It appears to me that (scroll-right 1) is kind of a temporary form of horizontal scrolling, which automatically cancels as to non-current lines in a vareity of situations when keyboard input is received.  Plain old scroll-right without the optional distance argument is semi-permanent, and non-current lines do not automatically return to a non-scrolled state.

F8 is undefined on OSX, but I saw in a grep search that "C-x >" is bound to scroll-right.  That behaves differently than (scroll-right 1) using the optional argument to control the distance.  I also tried using "C-u 1 C-x >", but it behaves the same as "C-x >".

The issue described in #29002 is not present when invoking "C-u 1 C-x >" or "C-x >" -- i.e., both of which appear to be semi-permanent forms of horizontal scrolling.

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

DATE:  [10-29-2017 12:23:33] <29 Oct 2017 21:23:33 +0200>
FROM:  Eli Zaretskii <[email-masked]>
> 
> > Date:  Sun, 29 Oct 2017 11:56:22 -0700
> > From:  Keith David Bershatsky <[email-masked]>
> > Cc:  [email-masked]
> > 
> > I agree ... and that leads us to bug #29002.  :)
> > 
> > In the normal situation, the screen refreshes when the arrow key is used and non-current lines cease to be horizontally scrolled.  In the current example, however, non-current lines remain horizontally scrolled and Emacs "thinks" that they are not.  When I say that Emacs "thinks" they are not, I am referring to IT.
> 
> What Emacs "thinks" is on display.  And there we see hscrolled lines.
> So first_visible_x must be non-zero, and that is what I see.  If
> first_visible_x were zero, you'd see the line's text starting with the
> first character of each line.  I very much doubt that this is somehow
> Windows-specific, since xdisp.c is the platform-independent part of
> the display engine.
> 
> Or maybe the horizontal scroll bar on macOS somehow causes this.  What
> happens if you scroll-right with some key, like F8, and not with the
> mouse?
> 
> (In any case, invoking scroll-right in this situation makes very
> little sense to me.)