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: Tue, 19 Oct 2021 12:09:59 +0200 Message-ID: References: <87eeyd3ul0.fsf@bernoul.li> <67bcd8c4-2028-46bb-7971-244304bb7c0a@gmx.at> <776a35b7-1920-2987-88ae-6dcab958a8e4@gmx.at> <0dff07fa-b56f-1227-9f17-94e9b9b4c296@gmx.at> <65006f88-1151-34fe-2741-a80d328f96c5@gmx.at> <312e15c3-83d3-99ee-ef73-8fd6013153cc@gmx.at> <7626992f-ab12-5df2-9061-77cb1e276556@gmx.at> <831r4idw8s.fsf@gnu.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="23297"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 38181@debbugs.gnu.org To: Carlos Pita , Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Oct 19 12:11:20 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 1mcm5X-0005rB-Io for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 19 Oct 2021 12:11:19 +0200 Original-Received: from localhost ([::1]:43186 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mcm5W-0008GA-FL for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 19 Oct 2021 06:11:18 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:34736) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mcm5H-0008EQ-AV for bug-gnu-emacs@gnu.org; Tue, 19 Oct 2021 06:11:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:37898) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mcm5H-0005Iq-1i for bug-gnu-emacs@gnu.org; Tue, 19 Oct 2021 06:11:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mcm5G-0007Cz-JD for bug-gnu-emacs@gnu.org; Tue, 19 Oct 2021 06:11: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: Tue, 19 Oct 2021 10:11: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.163463820927644 (code B ref 38181); Tue, 19 Oct 2021 10:11:02 +0000 Original-Received: (at 38181) by debbugs.gnu.org; 19 Oct 2021 10:10:09 +0000 Original-Received: from localhost ([127.0.0.1]:49444 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mcm4O-0007Bo-UT for submit@debbugs.gnu.org; Tue, 19 Oct 2021 06:10:09 -0400 Original-Received: from mout.gmx.net ([212.227.17.21]:48321) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mcm4M-0007BI-U2 for 38181@debbugs.gnu.org; Tue, 19 Oct 2021 06:10:08 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1634638200; bh=r+/WUcWpeJkgGGa+UD/Fs1nckXhDPaFzcVui8qJuhPU=; h=X-UI-Sender-Class:Subject:To:Cc:References:From:Date:In-Reply-To; b=ThK6ix/Y2S1VMHx0K3qeLE/MMwNYQVhLYZyOK2hNzTVGQNQdVh60eHBIlRXWavT0w sJe3d64XSjvZ94Rjn9fVRjMpcannpEtaG3Zx0YiBPiK04Ysck22Z8UdH6F0Y+CoZVy TmL3SecVTVSRWfI3OerOgUKH3RKRN0EOn71QZjLg= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Original-Received: from [192.168.1.101] ([46.125.249.127]) by mail.gmx.net (mrgmx104 [212.227.17.168]) with ESMTPSA (Nemesis) id 1MCbIx-1mTjdz1qDr-009gGr; Tue, 19 Oct 2021 12:10:00 +0200 In-Reply-To: Content-Language: en-US X-Provags-ID: V03:K1:SPBKeKmw9fMPWUip6oiNeK9xWsKlH5iM1td/K4EKeSU/wkXOokb XTyOmpl4uAQPSEeMgDHYcyIWZeUQ7O4s+P6i8FOap8znP9tvVCsWmQeLofo4UIAFvtJU9WJ EmnbQzNKxg3k0ChyOD2r15IzyUFglqKaUiK8PyCGIZyuEpgWYrK153RlITWCeMpQ5PuUtHW mO+c8vPwNB2nbFj/PqmtA== X-UI-Out-Filterresults: notjunk:1;V03:K0:IVLVrmBA+3I=:oEwyWCQGTKk6KJX3XBber7 QgN8Trt3b9VWszWidAUbVX4CW+sJrkL4nYM8XUkddfGCdvjkHt7+e+iRwcmGg/VswRfqBnqTk 13LpKJuilYscNYz3qBoAs1zqc0X5w2fiD85LU+o/IPvq/7eYruN8gkR5JfU9ISyAs0G6kJm8N VIIguA80BJmq9Hh5SwAtEq1XZQzJa+TjST6Yn436YYxzHA1ckMJJZhBLLUhFiHd0ACRjVctU2 /hvVHDIVRUUy5xyNIt/ADP+b1q8W2PJz7soWvVfCdqI1SC1AzfzsuAGlb5+trCdxYcn2GTzYm 704ae6MGeRDLVsmI+uifqRPzbzRW1ZNjtD7Lw5i9vlggrn7YNCEFJRM9o2E24u38wKM6+PWHs U1vjgvGeL/M7mWpB0CZpCy4wd24pHdVcCwdHFaG9lR10eioOh5lKtSIzpkDLSkBNC6QLNZOiI JpA6NmPhbw9Opvc/TWMPPWoMCrXqGJPiDYqPLkOFhPh+YNuRmdGMAZeGud3DoiFaQbznwlJTE yrh43p0Q3Kh2GcRvsRqkDLy1gdLuEirdEnfvkr86fkZ/+Bs15MlmxxT7LB57ZWn0Vt60cJSIU 6EM4uEnHlKqpG0MnRr4g/KIlDLZulLc+MyLCplNONw646wIANQBKrUJeWJrb1pjJyhlAm2rbe gZIr8ReqKBD8N1cVLUiWwc9J3+CRIm+hJ9mLMUvdZ77LP/PESDpTOYAwnrg3+FPUaQSE84Nut Qj68vaqLC6mSrnND6EqflbBcOdc3cWPY10g6wQj4KINvpShbLNPr6X4InCPnmXVs6ssdaj2v 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:217559 Archived-At: > 3) Now I add a redisplay before the fit: > > (progn > (switch-to-buffer-other-window "popup") > (erase-buffer) > (insert (mapconcat #'number-to-string (number-sequence 1 30) "\n")) > (redisplay t) > (fit-window-to-buffer)) > > Again, only about half of the numbers are visible and the window looks > as if its buffer has been scrolled down. But now by scrolling up I can > check that all the numbers fit the window. So the height of the window > is right but there is that unnecessary scrolling down of the contents. > > 4) Now I repeat with the forced redisplay even earlier: > > (progn > (switch-to-buffer-other-window "popup") > (redisplay t) > (erase-buffer) > (insert (mapconcat #'number-to-string (number-sequence 1 30) "\n")) > (fit-window-to-buffer)) > > This seems to work around the issue. > > I believe that in 3 there is some miscalculation during the insertion > of text into the buffer that forces a scroll, but I'm having a hard > time trying to explain that. Anyway, it's another case the > redisplay-before-fit advice can't cope with. In (3) the redisplay happens _after_ the insertion so redisplay may have to scroll the buffer to make point, which is at its maximum, visible. The subsequent 'fit-window-to-buffer' and the final implicit redisplay won't change the window's start position after that. If the window after the split were large enough to encompass 30 lines, this won't happen. In (4) the redisplay happens _before_ the insertion so erasing the buffer will set 'window-start' to 'point-min' and the implicit redisplay at the end will see point within the visible portion and not change 'window-start'. martin