aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/indent.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/src/indent.c b/src/indent.c
index adecc3622a8..2cacfbbe3c0 100644
--- a/src/indent.c
+++ b/src/indent.c
@@ -2068,9 +2068,26 @@ whether or not it is currently displayed in some window. */)
2068 start_x = window_column_x (w, window, start_col, cur_col); 2068 start_x = window_column_x (w, window, start_col, cur_col);
2069 } 2069 }
2070 2070
2071 itdata = bidi_shelve_cache (); 2071 /* When displaying line numbers, we need to prime IT's
2072 lnum_width with the value calculated at window's start, since
2073 that's what normal window redisplay does. Otherwise C-n/C-p
2074 will sometimes err by one column. */
2075 int lnum_width = 0;
2076 if (!NILP (Vdisplay_line_numbers)
2077 && !EQ (Vdisplay_line_numbers, Qvisual))
2078 {
2079 struct text_pos wstart;
2080 SET_TEXT_POS_FROM_MARKER (wstart, w->start);
2081 itdata = bidi_shelve_cache ();
2082 start_display (&it, w, wstart);
2083 move_it_by_lines (&it, 1);
2084 lnum_width = it.lnum_width;
2085 bidi_unshelve_cache (itdata, 0);
2086 }
2072 SET_TEXT_POS (pt, PT, PT_BYTE); 2087 SET_TEXT_POS (pt, PT, PT_BYTE);
2088 itdata = bidi_shelve_cache ();
2073 start_display (&it, w, pt); 2089 start_display (&it, w, pt);
2090 it.lnum_width = lnum_width;
2074 first_x = it.first_visible_x; 2091 first_x = it.first_visible_x;
2075 it_start = IT_CHARPOS (it); 2092 it_start = IT_CHARPOS (it);
2076 2093