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

From: Eli Zaretskii <[email-masked]>
Date: Thu, 26 Oct 2017 07:51:55 +0300

On October 26, 2017 6:45:57 AM GMT+03:00, Keith David Bershatsky <[email-masked]> wrote:
> Here is a link to a screen-shot depicting #29002:
> 
> https://www.lawlist.com/images/bug_hscl.png

This is not a bug; your expectations are incorrect.  To see why, modify your
recipe to omit the "scroll right" part (step 5).  You will see that bug-hscroll
reports zero.

When hscrolling only the current line, first_visible_x is set to zero, to
reflect the situation for the non-current lines, which are normally not
hscrolled.  However, if you invoke scroll-right, the non-current lines
become hscrolled, so you see a non-zero value of first_visible_x.
In addition, the manual hscroll temporarily disables auto-hscrolling,
and moving cursor re-enables it, which is why gou see the value
reset to zero.

Yes, it's complicated...

I'm not sure why you expected non-zero values in this case, but if you
want to identify this situation, use the function
hscrolling_current_line_p.  Or just calculate the value yourself
using w->hscroll.