Subject: Re: bug#27008: 26.0.50; auto-hscroll-mode and scroll-left

From: Eli Zaretskii <[email-masked]>
Date: Tue, 30 May 2017 17:56:07 +0300

> From: Stephen Berman <[email-masked]>
> Cc: [email-masked]
> Date: Sun, 21 May 2017 22:12:27 +0200
> 
> Why can't the other lines be displayed with hscroll set to
> w->min_hscroll, as they are with auto-hscroll-mode set to t?

Thanks, I've tried to implement this idea in the attached.  I won't
have enough time to test it, though, so please run with this applied
for a few days and see if there are any adverse effects.  If not, I
will push this.

diff --git a/src/xdisp.c b/src/xdisp.c
index ddb26b8..898eb6b 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -2890,8 +2890,19 @@ init_iterator (struct it *it, struct window *w,
     }
   else
     {
+      /* When hscrolling only the current line, don't apply the
+	 hscroll here, it will be applied by display_line when it gets
+	 to laying out the line showing point.  However, if the
+	 window's min_hscroll is positive, the user specified a lower
+	 bound for automatic hscrolling, so they expect the
+	 non-current lines to obey that hscroll amount.  */
       if (hscrolling_current_line_p (w))
-	it->first_visible_x = 0;
+	{
+	  if (w->min_hscroll > 0)
+	    it->first_visible_x = w->min_hscroll;
+	  else
+	    it->first_visible_x = 0;
+	}
       else
 	it->first_visible_x =
 	  window_hscroll_limited (w, it->f) * FRAME_COLUMN_WIDTH (it->f);