aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorEli Zaretskii2022-08-05 15:53:06 +0300
committerEli Zaretskii2022-08-05 15:53:06 +0300
commitaff596127476c0fbcb11ccbbce63f32d03785653 (patch)
treeab38e91954962467fc1200f2080e36edd52a320d /src
parent900b09c0235d54d56ef5e88d04cca61bc71cbbb7 (diff)
downloademacs-aff596127476c0fbcb11ccbbce63f32d03785653.tar.gz
emacs-aff596127476c0fbcb11ccbbce63f32d03785653.zip
Avoid assertion violations in 'back_to_previous_visible_line_start'
* src/xdisp.c (init_iterator): Always initialize narrowed_begv to zero, since SET_WITH_NARROWED_BEGV depends on it being non-zero as an indication that long-line optimizations are in use. (back_to_previous_visible_line_start): When long-line optimizations are in effect, we may end up not on a newline.
Diffstat (limited to 'src')
-rw-r--r--src/xdisp.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/xdisp.c b/src/xdisp.c
index 099efed2db1..3ca0022a6d3 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -3473,8 +3473,9 @@ init_iterator (struct it *it, struct window *w,
3473 &it->bidi_it); 3473 &it->bidi_it);
3474 } 3474 }
3475 3475
3476 if (current_buffer->long_line_optimizations_p) 3476 /* This is set only when long_line_optimizations_p is non-zero
3477 it->narrowed_begv = 0; 3477 for the current buffer. */
3478 it->narrowed_begv = 0;
3478 3479
3479 /* Compute faces etc. */ 3480 /* Compute faces etc. */
3480 reseat (it, it->current.pos, true); 3481 reseat (it, it->current.pos, true);
@@ -7412,7 +7413,7 @@ back_to_previous_visible_line_start (struct it *it)
7412 it->continuation_lines_width = 0; 7413 it->continuation_lines_width = 0;
7413 7414
7414 eassert (IT_CHARPOS (*it) >= BEGV); 7415 eassert (IT_CHARPOS (*it) >= BEGV);
7415 eassert (it->narrowed_begv > BEGV 7416 eassert (it->narrowed_begv > 0 /* long-line optimizations: all bets off */
7416 || IT_CHARPOS (*it) == BEGV 7417 || IT_CHARPOS (*it) == BEGV
7417 || FETCH_BYTE (IT_BYTEPOS (*it) - 1) == '\n'); 7418 || FETCH_BYTE (IT_BYTEPOS (*it) - 1) == '\n');
7418 CHECK_IT (it); 7419 CHECK_IT (it);