From c3fda2e34b9725c4931f10ce48df5b1917c916df Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sun, 5 Apr 2026 12:34:12 +0300 Subject: [PATCH] Fix display in window margins when text-area text is reordered * src/xdisp.c (handle_stop_backwards): Don't overwrite 'stop_charpos' if we end up on a different stack level of the iterator. (Bug#80693) --- src/xdisp.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/xdisp.c b/src/xdisp.c index bd07f9983ff..6f06206b43e 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -9752,6 +9752,7 @@ handle_stop_backwards (struct it *it, ptrdiff_t charpos) struct display_pos save_current = it->current; struct text_pos save_position = it->position; struct composition_it save_cmp_it = it->cmp_it; + int save_sp = it->sp; struct text_pos pos1; ptrdiff_t next_stop; @@ -9783,7 +9784,8 @@ handle_stop_backwards (struct it *it, ptrdiff_t charpos) next_stop = it->stop_charpos; it->stop_charpos = it->prev_stop; handle_stop (it); - it->stop_charpos = next_stop; + if (it->sp == save_sp) + it->stop_charpos = next_stop; } /* Load IT with the next display element from current_buffer. Value