]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix automatic hscrolling when line numbers are displayed
authorEli Zaretskii <eliz@gnu.org>
Fri, 6 Aug 2021 07:51:45 +0000 (10:51 +0300)
committerEli Zaretskii <eliz@gnu.org>
Fri, 6 Aug 2021 07:51:45 +0000 (10:51 +0300)
* src/xdisp.c (hscroll_window_tree): When line numbers are
displayed, account for the the line-number space when calculating
the desired X coordinate on the left.  (Bug#49891)

src/xdisp.c

index 70d15aee68c5010fbe2c3398544a1247bcd20704..e62f7e3df6ebef70282abc7828949f00f13d7325 100644 (file)
@@ -15082,11 +15082,12 @@ hscroll_window_tree (Lisp_Object window)
              else
                {
                  if (hscroll_relative_p)
-                   wanted_x = text_area_width * hscroll_step_rel
-                              + h_margin;
+                   wanted_x =
+                     text_area_width * hscroll_step_rel + h_margin + x_offset;
                  else
-                   wanted_x = hscroll_step_abs * FRAME_COLUMN_WIDTH (it.f)
-                              + h_margin;
+                   wanted_x =
+                     hscroll_step_abs * FRAME_COLUMN_WIDTH (it.f)
+                     + h_margin + x_offset;
                  hscroll
                    = max (0, it.current_x - wanted_x) / FRAME_COLUMN_WIDTH (it.f);
                }