aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEli Zaretskii2017-06-24 19:40:41 +0300
committerEli Zaretskii2017-06-24 19:40:41 +0300
commit0d5c713a6b21cd3bd8a232ff35924c65cd3cce6b (patch)
tree375e178edc064a006d0bb3ad4a86e783f6acc8f6
parent13cc19a0a3685ceade4a5a560475ee47165f3bbc (diff)
downloademacs-0d5c713a6b21cd3bd8a232ff35924c65cd3cce6b.tar.gz
emacs-0d5c713a6b21cd3bd8a232ff35924c65cd3cce6b.zip
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.
-rw-r--r--src/xdisp.c41
1 files changed, 24 insertions, 17 deletions
diff --git a/src/xdisp.c b/src/xdisp.c
index d0673595390..6fa1d841ee2 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -13070,27 +13070,34 @@ hscroll_window_tree (Lisp_Object window)
13070 bool row_r2l_p = cursor_row->reversed_p; 13070 bool row_r2l_p = cursor_row->reversed_p;
13071 bool hscl = hscrolling_current_line_p (w); 13071 bool hscl = hscrolling_current_line_p (w);
13072 int x_offset = 0; 13072 int x_offset = 0;
13073 struct glyph *g; 13073 /* When line numbers are displayed, we need to account for
13074 if (!row_r2l_p) 13074 the horizontal space they consume. */
13075 if (!NILP (Vdisplay_line_numbers))
13075 { 13076 {
13076 for (g = cursor_row->glyphs[TEXT_AREA]; 13077 struct glyph *g;
13077 g < cursor_row->glyphs[TEXT_AREA] + cursor_row->used[TEXT_AREA]; 13078 if (!row_r2l_p)
13078 g++)
13079 { 13079 {
13080 if (!(NILP (g->object) && g->charpos < 0)) 13080 for (g = cursor_row->glyphs[TEXT_AREA];
13081 break; 13081 g < cursor_row->glyphs[TEXT_AREA]
13082 x_offset += g->pixel_width; 13082 + cursor_row->used[TEXT_AREA];
13083 g++)
13084 {
13085 if (!(NILP (g->object) && g->charpos < 0))
13086 break;
13087 x_offset += g->pixel_width;
13088 }
13083 } 13089 }
13084 } 13090 else
13085 else
13086 {
13087 for (g = cursor_row->glyphs[TEXT_AREA] + cursor_row->used[TEXT_AREA];
13088 g > cursor_row->glyphs[TEXT_AREA];
13089 g--)
13090 { 13091 {
13091 if (!(NILP ((g - 1)->object) && (g - 1)->charpos < 0)) 13092 for (g = cursor_row->glyphs[TEXT_AREA]
13092 break; 13093 + cursor_row->used[TEXT_AREA];
13093 x_offset += (g - 1)->pixel_width; 13094 g > cursor_row->glyphs[TEXT_AREA];
13095 g--)
13096 {
13097 if (!(NILP ((g - 1)->object) && (g - 1)->charpos < 0))
13098 break;
13099 x_offset += (g - 1)->pixel_width;
13100 }
13094 } 13101 }
13095 } 13102 }
13096 13103