From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#38645: 26.3; minibuffer input is called with multi-line window when multi-line message is shown Date: Sun, 29 Dec 2019 16:15:28 +0200 Message-ID: <83a77bnrpb.fsf@gnu.org> References: <86fthfu3qe.fsf@gmail.com> <831rsqrevq.fsf@gnu.org> Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="163592"; mail-complaints-to="usenet@blaine.gmane.org" Cc: ynyaaa@gmail.com, 38645@debbugs.gnu.org To: martin rudalics Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun Dec 29 15:16:14 2019 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1ilZMZ-000gNf-2q for geb-bug-gnu-emacs@m.gmane.org; Sun, 29 Dec 2019 15:16:11 +0100 Original-Received: from localhost ([::1]:52430 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ilZMY-0002xB-1D for geb-bug-gnu-emacs@m.gmane.org; Sun, 29 Dec 2019 09:16:10 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:54157) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ilZMS-0002x5-Ui for bug-gnu-emacs@gnu.org; Sun, 29 Dec 2019 09:16:06 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ilZMR-00033z-Og for bug-gnu-emacs@gnu.org; Sun, 29 Dec 2019 09:16:04 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:53419) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ilZMQ-00033C-0P for bug-gnu-emacs@gnu.org; Sun, 29 Dec 2019 09:16:03 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1ilZMP-0004wq-T8 for bug-gnu-emacs@gnu.org; Sun, 29 Dec 2019 09:16:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 29 Dec 2019 14:16:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 38645 X-GNU-PR-Package: emacs Original-Received: via spool by 38645-submit@debbugs.gnu.org id=B38645.157762894218991 (code B ref 38645); Sun, 29 Dec 2019 14:16:01 +0000 Original-Received: (at 38645) by debbugs.gnu.org; 29 Dec 2019 14:15:42 +0000 Original-Received: from localhost ([127.0.0.1]:59392 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ilZM5-0004wE-PU for submit@debbugs.gnu.org; Sun, 29 Dec 2019 09:15:42 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:44539) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ilZM4-0004w3-RH for 38645@debbugs.gnu.org; Sun, 29 Dec 2019 09:15:41 -0500 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:47929) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ilZLy-00028U-3n; Sun, 29 Dec 2019 09:15:35 -0500 Original-Received: from [176.228.60.248] (port=3742 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1ilZLo-0007Lq-A1; Sun, 29 Dec 2019 09:15:33 -0500 In-reply-to: (message from martin rudalics on Fri, 27 Dec 2019 10:12:33 +0100) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:173887 Archived-At: > Cc: 38645@debbugs.gnu.org > From: martin rudalics > Date: Fri, 27 Dec 2019 10:12:33 +0100 > > > Martin, what do you think about the following fix? Is it correct, and > > if so, safe enough for the release branch? > > It seems "correct" in the sense that our doc of 'resize-mini-windows' > nowhere contradicts any such interpretation. It should be "safe" in > the sense that failing to always resize the minibuffer window exactly > and falling back on 'grow-only' should not do any harm since otherwise > we'd have a bug in the 'grow-only' part of the code. > > But I'm too silly to understand why the minibuffer window does not > re-grow in the first place after having shown the result of C-x C-e. > Can you enlighten me? I hope the following alternative patch will answer that question. Comments are welcome. diff --git a/src/keyboard.c b/src/keyboard.c index 4cf1f64b48..a04f1f77de 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -1318,6 +1318,11 @@ command_loop_1 (void) message1 (0); safe_run_hooks (Qecho_area_clear_hook); + /* We cleared the echo area, and the minibuffer will now + show, so resize the mini-window in case the minibuffer + needs more or less space than the echo area. */ + resize_mini_window (XWINDOW (minibuf_window), false); + unbind_to (count, Qnil); /* If a C-g came in before, treat it as input now. */ @@ -2989,6 +2994,16 @@ read_char (int commandflag, Lisp_Object map, { safe_run_hooks (Qecho_area_clear_hook); clear_message (1, 0); + /* If we were showing the echo-area message on top of an + active minibuffer, resize the mini-window, since the + minibuffer may need more or less space than the echo area + we've just wiped. */ + if (minibuf_level + && EQ (minibuf_window, echo_area_window) + /* The case where minibuffer-message-timeout is a number + was already handled near the beginning of this function. */ + && !NUMBERP (Vminibuffer_message_timeout)) + resize_mini_window (XWINDOW (minibuf_window), false); } else if (FUNCTIONP (Vclear_message_function)) clear_message (1, 0);