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

From: Keith David Bershatsky <[email-masked]>
Date: Sun, 29 Oct 2017 11:56:22 -0700

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.

There are few ways that I look at this unique situation:

A.  If the Emacs design is to permit non-current lines to remain horizontally scrolled in this unique situation, then we may need something like a new window pointer to store the value of the first-visible-x for those non-current lines.

  OR

B.  If the Emacs design is NOT to permit non-current lines to remain horizontally scrolled in this unique situation, then redisplay needs to refresh all non-current lines so that they snap back to a non-horizontal scroll state.

  OR

C.  IT is incorrect such that it.first_visible_x needs to be changed to reflect the proper value.  [From an untrained eye, it looks like the value is the same as w->hscroll in this unique situation.]

If this unique situation is "a feature", then we need a way to properly calculate the first-visible-x for non-current lines.  If this is *not* a feature, then redisplay should refresh all non-current lines so that they are no longer horizontally scrolled.

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

DATE:  [10-29-2017 11:29:16] <29 Oct 2017 20:29:16 +0200>
FROM:  Eli Zaretskii <[email-masked]>
> 
> > Date:  Sun, 29 Oct 2017 10:29:29 -0700
> > From:  Keith David Bershatsky <[email-masked]>
> > Cc:  [email-masked]
> > 
> > Here is a link to screen-shot #3:
> > 
> > https://www.lawlist.com/images/bug_hscl_03.png
> > 
> > In that screen-shot, we make the following observations:
> > 
> > * A total of 5 screen lines.
> > 
> > * Line 1 is the current line.
> > 
> > * All 5 lines visually appear to be horizontally scrolled.
> > 
> > * Using the revised function bug-hscroll (below), we iterate over each screen line and generate the values for it.first_visible_x and it.vpos.
> > 
> > * it.first_visible_x returns as being 0 for each of the 5 screen lines.
> 
> This cannot be true: if every line in the window is hscrolled,
> first_visible_x must be non-zero, right after the call to
> start_display.  If first_visible_x is zero, only the current line can
> be hscrolled.