From: Gerd Möllmann Date: Fri, 24 Jan 2025 10:18:54 +0000 (+0100) Subject: Disable more redisplay optimizations when child frames are visible X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=e16bae514b151aacd6a076c70078ba5b6b4bef67;p=emacs.git Disable more redisplay optimizations when child frames are visible * src/xdisp.c (redisplay_internal): Disable more optimizations on a tty root frame displaying a child frame. (try_cursor_movement,(try_window_reusing_current_matrix) (try_window_id): Don't use on tty root frames displaying a child frame. (cherry picked from commit 07a2a67e3bfd674daad7a7d8947a0ab67b4e13e8) --- diff --git a/src/xdisp.c b/src/xdisp.c index f030628124a..48fc1b58ffa 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -17216,7 +17216,11 @@ redisplay_internal (void) /* All text outside that line, including its final newline, must be unchanged. */ && text_outside_line_unchanged_p (w, CHARPOS (tlbufpos), - CHARPOS (tlendpos))) + CHARPOS (tlendpos)) + /* If this is a window on a tty root frame displaying a child frame, + the current matrix of W may contain glyphs of that child frame. + Don't try shortcuts that might use the current matrix in this case. */ + && !is_tty_root_frame_with_visible_child (XFRAME (w->frame))) { if (CHARPOS (tlbufpos) > BEGV && FETCH_BYTE (BYTEPOS (tlbufpos) - 1) != '\n' @@ -17281,11 +17285,7 @@ redisplay_internal (void) line and this line is the current one, because display_line above is not informed about the current-line's vpos, and cannot DTRT in that case. */ - && !hscrolling_current_line_p (w) - /* A root frame may have visible children displayed in its - current matrix, so that we can't do the below with its - current matrix. */ - && !is_tty_root_frame_with_visible_child (it.f)) + && !hscrolling_current_line_p (w)) { /* If this is not the window's last line, we must adjust the charstarts of the lines below. */ @@ -19432,6 +19432,13 @@ try_cursor_movement (Lisp_Object window, struct text_pos startp, struct frame *f = XFRAME (w->frame); int rc = CURSOR_MOVEMENT_CANNOT_BE_USED; + + /* If this is a window on a tty root frame displaying a child frame, + the current matrix of W may contain glyphs of that child frame, + so this method is not safe to use. */ + if (is_tty_root_frame_with_visible_child (f)) + return rc; + #ifdef GLYPH_DEBUG if (inhibit_try_cursor_movement) return rc; @@ -21335,6 +21342,13 @@ static bool try_window_reusing_current_matrix (struct window *w) { struct frame *f = XFRAME (w->frame); + + /* If this is a window on a tty root frame displaying a child frame, + the current matrix of W may contain glyphs of that child frame, + so this method is not safe to use. */ + if (is_tty_root_frame_with_visible_child (f)) + return false; + struct glyph_row *bottom_row; struct it it; struct run run; @@ -22122,6 +22136,13 @@ static int try_window_id (struct window *w) { struct frame *f = XFRAME (w->frame); + + /* If this is a window on a tty root frame displaying a child frame, + the current matrix of W may contain glyphs of that child frame, + so this method is not safe to use. */ + if (is_tty_root_frame_with_visible_child (f)) + return 0; + struct glyph_matrix *current_matrix = w->current_matrix; struct glyph_matrix *desired_matrix = w->desired_matrix; struct glyph_row *last_unchanged_at_beg_row;