1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-01-03 10:31:37 -08:00

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.
This commit is contained in:
Eli Zaretskii 2022-08-05 15:53:06 +03:00
parent 900b09c023
commit aff5961274

View file

@ -3473,8 +3473,9 @@ init_iterator (struct it *it, struct window *w,
&it->bidi_it);
}
if (current_buffer->long_line_optimizations_p)
it->narrowed_begv = 0;
/* This is set only when long_line_optimizations_p is non-zero
for the current buffer. */
it->narrowed_begv = 0;
/* Compute faces etc. */
reseat (it, it->current.pos, true);
@ -7412,7 +7413,7 @@ back_to_previous_visible_line_start (struct it *it)
it->continuation_lines_width = 0;
eassert (IT_CHARPOS (*it) >= BEGV);
eassert (it->narrowed_begv > BEGV
eassert (it->narrowed_begv > 0 /* long-line optimizations: all bets off */
|| IT_CHARPOS (*it) == BEGV
|| FETCH_BYTE (IT_BYTEPOS (*it) - 1) == '\n');
CHECK_IT (it);