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 cb57edcec0f..302f7db8815 100644 --- a/src/dispnew.c +++ b/src/dispnew.c @@ -3479,6 +3479,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 0b39402218a..ba8ba1b72e3 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. */