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#38181: Actual height of mode-line not taken into account Date: Sat, 16 Oct 2021 18:48:41 +0200 Message-ID: References: <87eeyd3ul0.fsf@bernoul.li> <2a0bf8c7-69df-0532-c6d8-5315ee9fee28@gmx.at> <67bcd8c4-2028-46bb-7971-244304bb7c0a@gmx.at> <776a35b7-1920-2987-88ae-6dcab958a8e4@gmx.at> 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="32335"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 38181@debbugs.gnu.org To: Carlos Pita Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Oct 16 18:49:10 2021 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 1mbmru-0008Cq-GV for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 16 Oct 2021 18:49:10 +0200 Original-Received: from localhost ([::1]:48388 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mbmrt-0005tI-Dl for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 16 Oct 2021 12:49:09 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:56684) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mbmrm-0005st-RG for bug-gnu-emacs@gnu.org; Sat, 16 Oct 2021 12:49:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:59611) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mbmrm-0003uo-II for bug-gnu-emacs@gnu.org; Sat, 16 Oct 2021 12:49:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mbmrm-0008LE-Ez for bug-gnu-emacs@gnu.org; Sat, 16 Oct 2021 12:49:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: martin rudalics Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 16 Oct 2021 16:49:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 38181 X-GNU-PR-Package: emacs Original-Received: via spool by 38181-submit@debbugs.gnu.org id=B38181.163440293132046 (code B ref 38181); Sat, 16 Oct 2021 16:49:02 +0000 Original-Received: (at 38181) by debbugs.gnu.org; 16 Oct 2021 16:48:51 +0000 Original-Received: from localhost ([127.0.0.1]:42924 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mbmra-0008Ko-SJ for submit@debbugs.gnu.org; Sat, 16 Oct 2021 12:48:51 -0400 Original-Received: from mout.gmx.net ([212.227.15.15]:59523) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mbmrZ-0008Kb-6x for 38181@debbugs.gnu.org; Sat, 16 Oct 2021 12:48:49 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1634402922; bh=UEyMFDOnJUAHUuFQ9Zoek/b2Sz+tzwDt8XBFxF7AMDg=; h=X-UI-Sender-Class:Subject:To:Cc:References:From:Date:In-Reply-To; b=QvfoIGby/6tApZPLhgylof95L8AJF1V7SmvTQ6U2gpEMBV5brweKmLBOp0o+apAie ypRwwNOr+qgP2/ipjPLVTXMrrDRZZ05TtQDOkAnkQNmHSd8H0cRxGRIWsKAPzuItRZ A25idhuT3jLWHRp3yEovwS2yxjr2xPDXReDYoFhc= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Original-Received: from [192.168.1.102] ([213.142.96.242]) by mail.gmx.net (mrgmx004 [212.227.17.190]) with ESMTPSA (Nemesis) id 1MpDNl-1n4rTh0JQd-00qmj4; Sat, 16 Oct 2021 18:48:42 +0200 In-Reply-To: Content-Language: en-US X-Provags-ID: V03:K1:Zs6ptK9VVr4q0h7YgEJKxsNy09t/NpL+c2Jitv7b8BdM0viGEm5 E1VU7X28X/R8gGg5aSJwhMcNOHnBBWFeooRZNac9+EsTZHdoPR6JPLtROxfTR1aj1sOwI7U S6xvGxVmOalENq0SXJNRaKwY5x3nIMpBuZKjGCIkR9jk4OVOscaIBvPI+BCVZX2Z+k5mufO hhUoS01I5MC8MlDfwUVMQ== X-UI-Out-Filterresults: notjunk:1;V03:K0:h0HPodhjXBs=:mxCu93Gh5H9Bq31dllOFbm 21eleDrlCNRKHm6psLIJlRu61knaTw8cK5qQn/YS1Yx2u0v6Gl3QA9TfIb9kN41WMBZuxnuKd IbDK9nBMenofIXNgtN9sEaMcx9i5pNmdLk9TNCQBcDS5rGpGAPm1w12J/av6CwS1uZDjKWWBT bs4hhl6+8PATKscRvNIbmlR+FkJyjTls+5T2Ff+g2zgrr1R6hRTEXGPawls1B4P0co73zp47d YdUxF62i9kmmhuMWThUnadGOn8skmh9zTeOipiBTB88xvXG1oHVC6bI3Ix2lsIjxNCqdhzDZY elUcZVgpgQyaSj6pMH7IMHLZKOLXsl4DcaF3wmTYqYEP+fxK1t7YsKcvU3FbEJqxnK9qo7JRc zYJ7yjpHg3vNSdIkkTAa5aeiVB1ueppkqm9mUkuQ/dlsRoZL5POExhlGgWgRTYY/7B2d71ikp kosbzyPwterBfJm+iu1u4in+In+NF2os7XdBGd2vA038+/ClnxwdftJhfIUORpy59JXTCmRdh yVaXnWNcjJIHp5KdAor2/whCfxzgThqEowD8B/HJmMP2yYE+bnpiAvFpxsMlCXEohU8x/WV3a FDd3wjIi6mtNa1MsJPGFebdGwgc2fWBFe9+Hs9b9WAJa8ZgS2TtMHPMe8VzBEvktBYQwIaUOh TFxLPRHxfYv65aFE4tGrwIeG21/ZS/K1aiqlBkFOn8tMYpQ2CGJ2vJBVHyR4DI+0gMfS9xezV VbsKTrIO2igJHO7x1V6+HJOPdCE5/zdA/c0kgEgdAxcJI4cIKA5fFDNsdYPEFkrIFJu/xa+S 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:217377 Archived-At: > Now, let's define test-popup-no-redisplay as the version of test-popup > with the call to redisplay removed, and test-popup-redisplay as the > version that calls redisplay before fitting the window to its buffer: > > (test-popup-no-redisplay) -> cropped content > close popup > (test-popup-no-redisplay) -> cropped content > close popup > (test-popup-redisplay) -> ok > close popup > (test-popup-redisplay) -> ok > close popup > (test-popup-no-redisplay) -> cropped content > close popup > > As you can see, the redisplay only "fixes" the next fit, after that the > problem reappears. Right. The "close popup" removes anything redisplay cached for the window's mode line in the last call of 'test-popup-redisplay'. > This may be of interest: > > (test-popup-no-redisplay) -> cropped content > (test-popup-no-redisplay) -> ok > (test-popup-no-redisplay) -> ok > (test-popup-no-redisplay) -> ok > > (N.B. I'm not closing the popup) It seems like the window was reused > and the second time it got things right. Right. It always uses the cached mode line height in this case. > My interpretation is that the early redisplay "prepares" the current > window for the fit. Now, the workaround that I linked above does a > redisplay once per buffer, not once per window. What is the "workaround"? IIUC there is no "redisplay" one can call on a "per buffer" base. > The issue I observe, > which I believe is the same one that motivated this report in the > first place, is an org-set-tags-command menu clipped at the bottom > (it's not the only case, though). Since the popup windows that > org-mode opens for this and other menus are transient but their > buffers likely remain hidden, that may be the reason why the > workaround is not, well, working around. What I'm failing to grasp is > how could it ever work... maybe there was some change in the > implementation of org-mode popups. > > I would be happy with a sound statement like "if you change the > modeline height so it is different to the default char size, you need > to call redisplay for each window that sports the modified modeline > before executing any operation that requires knowledge of the geometry > of that modeline, including fit-window-to-buffer". If that's true then the > current trick could be reasonably modified to cope with every possible > case instead of hooking to particular functions (fit-window-to-buffer) in > maybe the wrong scope (buffer), by just triggering an early redisplay > each time a new window is created. Even the 'redisplay' trick will not be sufficient: Consider Eli's scenario in this thread but with _different_ heights for active and inactive mode lines. It will break things when after doing the 'fit-window-to-buffer' call you (de-)select the window you've just fit. > Rereading (some of) the above thread, I noticed you said: > >> If we don't want 'fit-window-to-buffer' to do that always we'd need >> some variable, either buffer local or even a window parameter, that >> 'fit-window-to-buffer' would inspect once and reset immediately in >> order to perform only the redisplay call that's really needed. > > I believe this is similar to what I've just suggested. Then a long > discussion full of technicalities that I won't be able to follow in > depth anytime soon took place. I understand that maybe forcing an > early display is not ideal because, in principle, we only want to > update the size of the modeline, not prematurely redisplay the window. > Moreover, modelines could change after creating a window, > but this is not an interesting use case in real life. > But since creating a window is not a frequent operation, and > changing a modeline on the fly is not a likely event, would it be > so bad to trigger that early redisplay on window creation? I think you mean with every set_window_buffer? And probably with every set_window_configuration too. Did you try it? > I'm not saying that emacs should do it, I'm confident that your > decision in this regard will be far better than anything I could > come up with, I'm just looking for a workaround that gets the job > done or, alternatively, the certainty that it's a bad idea and that we > should refrain from pretiffing modelines. Here I have no problems with the scenarios I've seen in this thread because I update the mode line caches with every change of a window height (which includes the case where a window is created) and with any change of a buffer local variable like 'mode-line-format'. So basically no redisplay is ever needed in the first place, just a recalculation of the mode line heights of all windows whose heights have changed. martin