From: Gerd Möllmann Date: Tue, 21 Jan 2025 17:31:10 +0000 (+0100) Subject: Don't use a redisplay optimization in a certain case on ttys X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=6696283a7363acf870ed4b0b08792fbb98bb231b;p=emacs.git Don't use a redisplay optimization in a certain case on ttys * src/dispnew.c (is_tty_root_frame_with_visible_child): New function. * src/dispextern.h: Declare it. * src/xdisp.c (redisplay_internal): Don't use optimization 1 for tty root frames with a visible child frame. (cherry picked from commit 0fd5b2d146e3578820446aa69b30d93958d9b1a5) --- diff --git a/src/dispextern.h b/src/dispextern.h index 9284d3a99ee..ccf0aebd7c6 100644 --- a/src/dispextern.h +++ b/src/dispextern.h @@ -3953,6 +3953,7 @@ Lisp_Object frames_in_reverse_z_order (struct frame *f, bool visible); bool is_tty_frame (struct frame *f); bool is_tty_child_frame (struct frame *f); bool is_tty_root_frame (struct frame *f); +bool is_tty_root_frame_with_visible_child (struct frame *f); void combine_updates (Lisp_Object root_frames); void combine_updates_for_frame (struct frame *f, bool inhibit_id_p); void tty_raise_lower_frame (struct frame *f, bool raise); diff --git a/src/dispnew.c b/src/dispnew.c index c3c8b1123b7..ff413fab574 100644 --- a/src/dispnew.c +++ b/src/dispnew.c @@ -3476,6 +3476,18 @@ is_tty_root_frame (struct frame *f) return !FRAME_PARENT_FRAME (f) && is_tty_frame (f); } +/* Return true if frame F is a tty root frame that has a visible child + frame.. */ + +bool +is_tty_root_frame_with_visible_child (struct frame *f) +{ + if (!is_tty_root_frame (f)) + return false; + Lisp_Object z_order = frames_in_reverse_z_order (f, true); + return CONSP (XCDR (z_order)); +} + /* Return the index of the first enabled row in MATRIX, or -1 if there is none. */ diff --git a/src/xdisp.c b/src/xdisp.c index 73e96bd45d7..51b0ecf0405 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -17279,7 +17279,11 @@ 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)) + && !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)) { /* If this is not the window's last line, we must adjust the charstarts of the lines below. */