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).
This commit is contained in:
Martin Rudalics 2019-03-04 10:11:53 +01:00
parent 716ff449ef
commit a810a75aa2
2 changed files with 19 additions and 8 deletions

View file

@ -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. */

View file

@ -12062,18 +12062,25 @@ x_consider_frame_title (Lisp_Object frame)
/* Set global variable indicating that multiple frames exist. */
multiple_frames = CONSP (tail);
/* 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));
/* 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. */
specbind (Qinhibit_redisplay, Qt);
Fselect_window (f->selected_window, Qt);
set_buffer_internal_1