From a810a75aa2d0cd5f43ec4b733fdcafabbfe8c5c3 Mon Sep 17 00:00:00 2001 From: Martin Rudalics Date: Mon, 4 Mar 2019 10:11:53 +0100 Subject: [PATCH] Fix minibuffer resizing with temporarily selected frames (Bug#34317) * src/keyboard.c (command_loop_1): Resize echo area exactly only if the echo area window is the minibuffer window of the selected frame (Bug#34317). * src/xdisp.c (x_consider_frame_title): Inhibit redisplay also when restoring the selected window/frame to avoid that resize_mini_window sizes back the minibuffer window of a temporarily selected frame (Bug#34317). --- src/keyboard.c | 8 ++++++-- src/xdisp.c | 19 +++++++++++++------ 2 files changed, 19 insertions(+), 8 deletions(-) diff --git a/src/keyboard.c b/src/keyboard.c index 1bde3a13ba5..760cd623f63 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -1476,8 +1476,12 @@ command_loop_1 (void) safe_run_hooks (Qpost_command_hook); /* If displaying a message, resize the echo area window to fit - that message's size exactly. */ - if (!NILP (echo_area_buffer[0])) + that message's size exactly. Do this only if the echo area + window is the minibuffer window of the selected frame. See + Bug#34317. */ + if (!NILP (echo_area_buffer[0]) + && (EQ (echo_area_window, + FRAME_MINIBUF_WINDOW (XFRAME (selected_frame))))) resize_echo_area_exactly (); /* If there are warnings waiting, process them. */ diff --git a/src/xdisp.c b/src/xdisp.c index d728e0f111c..ffab1ded4a5 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -12062,19 +12062,26 @@ x_consider_frame_title (Lisp_Object frame) /* Set global variable indicating that multiple frames exist. */ multiple_frames = CONSP (tail); - /* Switch to the buffer of selected window of the frame. Set up - mode_line_target so that display_mode_element will output into - mode_line_noprop_buf; then display the title. */ - record_unwind_protect (unwind_format_mode_line, - format_mode_line_unwind_data - (f, current_buffer, selected_window, false)); /* select-frame calls resize_mini_window, which could resize the mini-window and by that undo the effect of this redisplay cycle wrt minibuffer and echo-area display. Binding inhibit-redisplay to t makes the call to resize_mini_window a no-op, thus avoiding the adverse side effects. */ + + /* The following was moved before the record_unwind_protect form + below to inhibit redisplay also when restoring the selected + window/frame: This avoids that resize_mini_window sizes back + the minibuffer window of a temporarily selected frame. See + Bug#34317. */ specbind (Qinhibit_redisplay, Qt); + /* Switch to the buffer of selected window of the frame. Set up + mode_line_target so that display_mode_element will output into + mode_line_noprop_buf; then display the title. */ + record_unwind_protect (unwind_format_mode_line, + format_mode_line_unwind_data + (f, current_buffer, selected_window, false)); + Fselect_window (f->selected_window, Qt); set_buffer_internal_1 (XBUFFER (XWINDOW (f->selected_window)->contents)); -- 2.39.2