From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: martin rudalics Newsgroups: gmane.emacs.bugs Subject: bug#44933: 27.1; Ephemeral frame selection shrinks minibuffer Date: Mon, 30 Nov 2020 10:04:54 +0100 Message-ID: <0dec5a12-e2f6-a210-6300-835bb3358d53@gmx.at> References: <65A18F9E-3193-4DBD-84D8-4EDCA5AB95A1@toadstyle.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="27085"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 44933@debbugs.gnu.org To: Sean Devlin Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Nov 30 10:06:48 2020 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kjf8y-0006xD-0R for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 30 Nov 2020 10:06:48 +0100 Original-Received: from localhost ([::1]:35538 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kjf8t-0003YK-3U for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 30 Nov 2020 04:06:46 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:34768) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kjf8H-0003Xa-8M for bug-gnu-emacs@gnu.org; Mon, 30 Nov 2020 04:06:05 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:41868) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kjf8E-0001SH-R6 for bug-gnu-emacs@gnu.org; Mon, 30 Nov 2020 04:06:04 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1kjf8E-0005i0-La for bug-gnu-emacs@gnu.org; Mon, 30 Nov 2020 04:06:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: martin rudalics Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 30 Nov 2020 09:06:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 44933 X-GNU-PR-Package: emacs Original-Received: via spool by 44933-submit@debbugs.gnu.org id=B44933.160672710621855 (code B ref 44933); Mon, 30 Nov 2020 09:06:02 +0000 Original-Received: (at 44933) by debbugs.gnu.org; 30 Nov 2020 09:05:06 +0000 Original-Received: from localhost ([127.0.0.1]:53410 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kjf7J-0005gP-8P for submit@debbugs.gnu.org; Mon, 30 Nov 2020 04:05:05 -0500 Original-Received: from mout.gmx.net ([212.227.15.18]:40751) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kjf7H-0005fl-IL for 44933@debbugs.gnu.org; Mon, 30 Nov 2020 04:05:04 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1606727096; bh=O2seaZeS+AYnmQACm3MFFpfEwoGsn/bSyQ16TCNYG7g=; h=X-UI-Sender-Class:Subject:To:Cc:References:From:Date:In-Reply-To; b=RAopnCG7reoY2ZSc1FWzZlorzl+CAUMLq9GKnEhArxyB1BMWVsQdo+mVthlSEg5cc fYmjbzqecs8H7B0OYN+ucD/HMXbFtOE9OjSjOvohHG1Gv0n6tSPqw7xWJF3LefznHo nGVfMbR+DmCdHOjYcAXfXoL0AZCsHNxl/ly1lgr8= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Original-Received: from [192.168.1.100] ([212.95.5.17]) by mail.gmx.com (mrgmx004 [212.227.17.190]) with ESMTPSA (Nemesis) id 1MA7GS-1kvBh42SiY-00BYvi; Mon, 30 Nov 2020 10:04:56 +0100 In-Reply-To: Content-Language: en-US X-Provags-ID: V03:K1:jGV6BF5dxGXuqfMGnbr0LLKdBoqYKzMu90zTYVv80IhN8y9W+xb rJilymwnHlMTilZk8uB1bilb08mG4E8pxf4vkFblIIw3mqZWI6xvh/0Nnn4haW0Q3rOpSp7 vIZv16OeXMU3OPGGVux3JB4x9CXVQ4PvcUL3+SnxJ3nPa46oY5IJd6zf+jwGHQKsWlOqof3 iiOM0IQbKlc4pEIJjTWig== X-UI-Out-Filterresults: notjunk:1;V03:K0:zd6IkpQexjc=:8OuzjmWbc8RC8tNlRFus83 zD/9bakulEraCtmlPdEsrPoSwGtah2bad7udBwEojVmks+Kr6gc8bI5Qh6m2ZvJGbl22dDukZ 9Jl945jLHNTHP47rwif7oXUjpT4idEjaZ+cGYqk4uKqzj45boaR8KDBVqDr4Zvw/NnLvG4XFx 8JAmeJK/b8uhxAigFI9HPWUq+LJuo664uvkpkVgST5nidzFNK3w0a/apYrVwdVjVNYJEMyAmC i64bCXTrW2TOEl9Df/iO1+E/4h/W9birGxFecdpo+btZYxH0rdPs7qRHhGXhgto67WqGb/LBK yJYMgTD/rVJzSlpVxjiofaMt8rIDkQYJgqMAOTMR9SojitJejO2K/qLUjpKDW01E591KJhjVW UhWZaJeXVdicD80JwSkieydH7kE0QZPBzikgEZ9nTA0thmD5quu5F/12mqQ/vIMvtGe9wg5ON EUmXZWcSfulJpcV78QyeVnncg3a6Ve+QWAVizAc7kSPLCMRtKK7Plu5i49IZjCalKM39oLWB7 C9krBFtCdHl6MEw6C1mEEpLJ+Owi7EKpabM3XikqDor/aCsvDMiQr1dxB9U5WX3EITXUDUQRN V9MVMRIx2SMl7ZidS8u/+8l3tnHbufYpIJyqI6b/rNsHLerRJoACS90BTTjR9EVTLaucwoRAu P4pEn+C7GUKKw3KmSEew1cydT70rN0/8vHpqbM7xqkKJn/1+pVrXrBFn8vxexPIuciJhHhblO WGLgF7eNQZP+d/x/HXyIayj6lk8ezqwduFY12+mXMz8x8hLBgLcu8Z/VpFp2TfgGXt+ZtK0n X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list 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-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:194590 Archived-At: > In my reproduction, the minibuffer window is grown manually via > `window-resize`. With 'resize-mini-windows' non-nil this usually has no visible effect because any such manual resizing is immediately undone by the automatic resizing scheme. > In the case of selectrum, the completing read > candidates are displayed via overlay. I think this means that a > resizing function that considers the buffer text only will resize > these back down to a single line. The routine that determines the window size (resize_mini_window in xdisp.c) should consider overlays as well (if they are in the right buffer). Anything else would be a bug. > I just tested, and binding `resize-mini-windows` to nil around the > window selection in `term-emulate-terminal` does solve my > problem. Does this seem like the right fix? I think it is surprising > that output from a term process coming in the background should resize > a minibuffer window (and especially an active one). If you look into the code of do_switch_frame (in frame.c) you will be able to spot if (!for_deletion && FRAME_HAS_MINIBUF_P (sf)) resize_mini_window (XWINDOW (FRAME_MINIBUF_WINDOW (sf)), 1); which means that currently even redisplay itself may resize the mini window every time it constructs a mode line or frame title. I can only offer two advices: (1) Avoid 'with-selected-window/frame' in timers and (2) make sure no redisplay happen _within_ such a form. > Also, I see that `term-emulate-terminal` is calling `select-window` to > perform its window selections. From my reading of the docs, I think it > might make sense for it to pass `mark-for-redisplay` as the `norecord` > argument. It doesn't seem like we should be modifying the buffer list > or most recently selected window in this case, but we do want to > redisplay the new output. I would have to understand the semantics of 'term-emulate-terminal' to answer that. Hopefully, someone else can chime in here. > I think the documentation should clarify that window selection can > change window sizes as a side effect. The docs for selecting windows > (https://www.gnu.org/software/emacs/manual/html_node/elisp/Selecting-Windows.html) > do not mention that `select-window` can change minibuffer sizes. The > docs for minibuffer windows > (https://www.gnu.org/software/emacs/manual/html_node/elisp/Minibuffer-Windows.html) > do mention these variables to control how minibuffer windows can be > resized automatically, but they do not say what functions might try to > do this automatic resizing. With the recently added 'minibuffer-follows-selected-frame' we now have an additional source of complications to consider. Maybe you could, as soon as the implementation of the latter has consolidated, play with the various values of 'resize-mini-windows' and suggest suitable fixes for the documentations of 'select-window' and 'select-frame'. Alternatively, we could consider skipping the resize_mini_window (XWINDOW (FRAME_MINIBUF_WINDOW (sf)), 1); above for temporary window/frame selections (and at least for redisplay as I currently do here) but the consequences of such a step are not easily fathomable. > Finally, I wonder if `with-selected-window` (which > `term-emulate-terminal` does not currently use) should bind > `resize-mini-windows`. ... with the consequences I mentioned in the sentence before ... > The docs say it is "the preferred way to > temporarily work with" a selected window, so it does seem like > automatic resizing is not in the spirit of the function. On the other > hand, I don't know all the existing use cases; maybe this would break > things. Right. martin