emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] scratch/line-numbers 0d5c713 13/14: Move additional hscrol


From: Eli Zaretskii
Subject: [Emacs-diffs] scratch/line-numbers 0d5c713 13/14: Move additional hscrolling code into a suitable 'if'
Date: Sat, 24 Jun 2017 13:12:54 -0400 (EDT)

branch: scratch/line-numbers
commit 0d5c713a6b21cd3bd8a232ff35924c65cd3cce6b
Author: Eli Zaretskii <address@hidden>
Commit: Eli Zaretskii <address@hidden>

    Move additional hscrolling code into a suitable 'if'
    
    * src/xdisp.c (hscroll_window_tree): Make additional calculations
    regarding glyphs produced for line numbers conditional on
    line-number display.
---
 src/xdisp.c | 41 ++++++++++++++++++++++++-----------------
 1 file changed, 24 insertions(+), 17 deletions(-)

diff --git a/src/xdisp.c b/src/xdisp.c
index d067359..6fa1d84 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -13070,27 +13070,34 @@ hscroll_window_tree (Lisp_Object window)
          bool row_r2l_p = cursor_row->reversed_p;
          bool hscl = hscrolling_current_line_p (w);
          int x_offset = 0;
-         struct glyph *g;
-         if (!row_r2l_p)
+         /* When line numbers are displayed, we need to account for
+            the horizontal space they consume.  */
+         if (!NILP (Vdisplay_line_numbers))
            {
-             for (g = cursor_row->glyphs[TEXT_AREA];
-                  g < cursor_row->glyphs[TEXT_AREA] + 
cursor_row->used[TEXT_AREA];
-                  g++)
+             struct glyph *g;
+             if (!row_r2l_p)
                {
-                 if (!(NILP (g->object) && g->charpos < 0))
-                   break;
-                 x_offset += g->pixel_width;
+                 for (g = cursor_row->glyphs[TEXT_AREA];
+                      g < cursor_row->glyphs[TEXT_AREA]
+                        + cursor_row->used[TEXT_AREA];
+                      g++)
+                   {
+                     if (!(NILP (g->object) && g->charpos < 0))
+                       break;
+                     x_offset += g->pixel_width;
+                   }
                }
-           }
-         else
-           {
-             for (g = cursor_row->glyphs[TEXT_AREA] + 
cursor_row->used[TEXT_AREA];
-                  g > cursor_row->glyphs[TEXT_AREA];
-                  g--)
+             else
                {
-                 if (!(NILP ((g - 1)->object) && (g - 1)->charpos < 0))
-                   break;
-                 x_offset += (g - 1)->pixel_width;
+                 for (g = cursor_row->glyphs[TEXT_AREA]
+                        + cursor_row->used[TEXT_AREA];
+                      g > cursor_row->glyphs[TEXT_AREA];
+                      g--)
+                   {
+                     if (!(NILP ((g - 1)->object) && (g - 1)->charpos < 0))
+                       break;
+                     x_offset += (g - 1)->pixel_width;
+                   }
                }
            }
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]