Commit 86b6e910 authored by Eli Zaretskii's avatar Eli Zaretskii
Browse files

Avoid assertion violations in calculating line-number width

* src/indent.c (line_number_display_width): Don't use the
window's start marker if it belongs to a different buffer.
(Bug#35429)
parent 82fc8ca6
Pipeline #1473 passed with stage
in 52 minutes and 42 seconds
...@@ -1968,8 +1968,11 @@ line_number_display_width (struct window *w, int *width, int *pixel_width) ...@@ -1968,8 +1968,11 @@ line_number_display_width (struct window *w, int *width, int *pixel_width)
outside the accessible region, in which case we widen the outside the accessible region, in which case we widen the
buffer temporarily. It could even be beyond the buffer's end buffer temporarily. It could even be beyond the buffer's end
(Org mode's display of source code snippets is known to cause (Org mode's display of source code snippets is known to cause
that), in which case we just punt and start from point instead. */ that) or belong to the wrong buffer, in which cases we just
if (startpos.charpos > Z) punt and start from point instead. */
if (startpos.charpos > Z
|| !(BUFFERP (w->contents)
&& XBUFFER (w->contents) == XMARKER (w->start)->buffer))
SET_TEXT_POS (startpos, PT, PT_BYTE); SET_TEXT_POS (startpos, PT, PT_BYTE);
if (startpos.charpos < BEGV || startpos.charpos > ZV) if (startpos.charpos < BEGV || startpos.charpos > ZV)
{ {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment