From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: martin rudalics via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#73022: 31.0.50; Crash in build_frame_matrix_from_leaf_window after C-x 2 and reducing terminal size Date: Thu, 12 Sep 2024 11:49:36 +0200 Message-ID: <718661cf-90f1-4590-b635-778dc3a5a099@gmx.at> References: <86le07624j.fsf@gnu.org> <60579ab6-db81-4f6e-b281-0cee03dc3b82@gmx.at> <86cyli4fxj.fsf@gnu.org> <86seue2l2b.fsf@gnu.org> <2d8e4603-5ea6-41e9-abfe-461392f717db@gmx.at> <4c3591f1-7c26-489f-ba68-8586e98cd99e@gmx.at> <861q1qpehg.fsf@gnu.org> <0e489c29-8274-4610-835a-b01c66a48fca@gmx.at> <86wmjinsao.fsf@gnu.org> Reply-To: martin rudalics 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="23643"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla Thunderbird Cc: n142857@gmail.com, 73022@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Sep 12 11:50:17 2024 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 1sogSt-0005wQ-V3 for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 12 Sep 2024 11:50:16 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sogSb-0001MY-Qe; Thu, 12 Sep 2024 05:49:58 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sogSZ-0001MB-Vg for bug-gnu-emacs@gnu.org; Thu, 12 Sep 2024 05:49:56 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sogSZ-000688-Mo for bug-gnu-emacs@gnu.org; Thu, 12 Sep 2024 05:49:55 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=In-Reply-To:From:References:MIME-Version:Date:To:Subject; bh=vXGZBQcPFbqzPEud+39t0pkdEF4ilcKrxsT1ZZVaaMQ=; b=JvTQDjiuaKpCHR6YdLy+n5oBiTXayPkxcl/ykqknapmHpnd1T8aFwOlLnIGXtLn8Bk1Xl0SKl1a8Q1uR7Q3vz5jYPyh9cWhqsa9/0TnSDvgfwRmWh5v22bC8fQ04Ncm6y2qsWZBzW0VJJ4C2zFOh+fR0ZfSDMhuZsyI7WKqALsGV0q8scCyh41CKQN855POJL2DY4kOt4CKiRkfVM5qmsx5k3k2PNSc4CeSqQM9wFPJtc2LaL95Asshy5MwPyaZDJcD4RFniLwaJzPTmdVzZmlukEHNmYAl7IJShsrKqGbpBnrwOHReGxTY7yToBeyZlnTMpGLcRz2XIXXM6X3z5+Q==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1sogSg-0006q9-5g for bug-gnu-emacs@gnu.org; Thu, 12 Sep 2024 05:50: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: Thu, 12 Sep 2024 09:50:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 73022 X-GNU-PR-Package: emacs Original-Received: via spool by 73022-submit@debbugs.gnu.org id=B73022.172613459826276 (code B ref 73022); Thu, 12 Sep 2024 09:50:02 +0000 Original-Received: (at 73022) by debbugs.gnu.org; 12 Sep 2024 09:49:58 +0000 Original-Received: from localhost ([127.0.0.1]:40164 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sogSb-0006pk-RN for submit@debbugs.gnu.org; Thu, 12 Sep 2024 05:49:58 -0400 Original-Received: from mout.gmx.net ([212.227.17.21]:53353) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sogSX-0006pN-RE for 73022@debbugs.gnu.org; Thu, 12 Sep 2024 05:49:55 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmx.at; s=s31663417; t=1726134577; x=1726739377; i=rudalics@gmx.at; bh=vXGZBQcPFbqzPEud+39t0pkdEF4ilcKrxsT1ZZVaaMQ=; h=X-UI-Sender-Class:Message-ID:Date:MIME-Version:Subject:To:Cc: References:From:In-Reply-To:Content-Type: Content-Transfer-Encoding:cc:content-transfer-encoding: content-type:date:from:message-id:mime-version:reply-to:subject: to; b=iiztHktz8ZkSfVfEvJVc4NZrOcJRibEolN9iMbaf15mtPjlwJ5ZYiNn5ue26MvR0 zqqrQh5em4CRNWj1uRL2bdoNHtYeg3KVfT+CTxb+OSe0Lk8uHFRxMUm06CSeaEXWS gM4zgrQUA2UxI3KlOaRzyd/1se9pJRbW0MGUx76YTOar2DqI2oqAxxGTN2Z+qndeq uD+YtPDlMfeSjUJ8n2w3bkREIObZVu5N/n1rz5uGYbid7ZlX8VGL2ptYj1OlxmtGz cBK5tpmYdwrXfwHfN8l+B+SDBzWljfzTUEgN3NC4Q8rm1So8Gm9tFDZpzGcll4Pfz ALP2k66VMuWpw0OXWw== X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a Original-Received: from [192.168.31.113] ([46.125.249.45]) by mail.gmx.net (mrgmx104 [212.227.17.168]) with ESMTPSA (Nemesis) id 1MowGU-1sDe4V0NxO-00qW39; Thu, 12 Sep 2024 11:49:37 +0200 Content-Language: en-US In-Reply-To: <86wmjinsao.fsf@gnu.org> X-Provags-ID: V03:K1:gZ4Bdk8Ne2QG5303yBKvlLsldVW85qvGPHNZRu88BBjbcUYkMI7 LlI96iY4GSosNol7dlYTbJjgHiIUR1JrXQcwStmlSxd463r1sXEvCT8/GPSGPOh+8YK08C1 kRo3Ar8xz/jH0rrgtfTTdbfNfV51CtNLLxZs5NLMrUR21sJQ0OFoce99fV6NH0VKSg1qFom F1n46yxmSgMzeWrK98aqA== UI-OutboundReport: notjunk:1;M01:P0:gOEBjfKPQNg=;q1CbYekKkSvTVBPp+o3n3Xznzjd nVkXnPzj3cMsAnSersgg5HyIp5Z6Oj6ormLXFUXjDbA+TLmvCLnB/xG17i+gMqyeQQTmHIJv8 iC4K/wDvmyJw6J0M7V03k/vMpqZgVLl28vVMq6cJK++B+WxNTgq2lq1UyV80R0WgMM84/rR0d mzLfKDRE9flpMBwSdcwqeRb2BpBRZhfd8HMl5OAv2tiEC2OI57IDUrxA0x8SJdJXfGqS6P2bY vm4KRjl0mfn9HsU9/V/1nc8+x3FF6QBlbeiAODBUQhAjSuRQn2twGuDA++B5kM/HSSOjxOwf1 r79sEKL7V4q6xcUg2CU7Ul8BdLNUKXF8XJaW0t5XBqAipt4sAnDgsQEUd5bOCmG9vEsm4GQi8 NjtBUkvHgQU0Uqx/hoL+/hFAZk0mkYXjSxky/K3bDdaSIwIoeesvLjQ3zlBvmSkEAKS+3wvVv aQiEjBbK7cistRMNM85IGcEzxoBaQJFlJSQBHxnSpFbSTRX5VOGMWnjkove15C+kgEnmh7W3E Zu+S+IjXgF+NYBXiHgI3x+a9U+LYjMMUBmosnKOmNn84zBN7tZnCzQSYlvvnFx7HHfJPeDObc 1maiSrxX4hXHe6nOLyCWIutFry30DIrJNsXxGZG3vmJKl7HehNapdCNprSYat8zbtkOGeJU+2 F0v5qceU4m3veTXL89JNmcmurbqphbsdFPFWdAyy4/TXQvkKlmzwpkwStOodlXv4U2fb4kCg2 /wRGXGmE393CrZOrvCaW+4JjyE/ha3egHAKVooDYi28yrwqHNhC8hA4/e8zWpZYfaak6xMtN 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-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:291629 Archived-At: >> It _might_ be incorrect when we allow FRAME_TOTAL_LINES (f) to exceed >> FrameRows (FRAME_TTY (f)) because we refuse to shrink a frame below some >> height. That's why I used the term "probably". If I knew what that >> code does in all consequences, I could tell you more. But I don't know. > > If FRAME_TOTAL_LINES is different from FrameRows at that spot, it's a > bug, isn't it? It depends. On a GUI frame do the following: In *scratch* insert the two lines (insert (format "%s" (frame-native-height))) (insert (format "%s" (window-pixel-height (frame-root-window)))) and then do C-x 2 three times so yet get four windows. Now with the mouse drag the lower border upwards as far as you can. The minibuffer window should have disappeared by now. Evaluate the two lines above by putting point at their end and typing C-x e. You will see that the second value exceeds the first one - the root window got larger than its frame. So the window dimensions as Emacs can reasonably draw them exceed the dimensions of the window as the WM gives them to us. The same thing happens on TTY frames. With split windows, the size of the root window may exceed the size of the terminal window. Whether we now synch FRAME_TOTAL_LINES and FrameRows is just a matter of taste. > I still don't understand what is supposed to happen when we shrink the > frame to less lines/columns than the minimum window dimensions we > allow. There are two minimum window dimensions we "allow": The first are the hard-coded 5/2 values in handle_window_change_signal and additionally imposed in frame_windows_min_size. IIUC neither of these takes care of menu or tab bars nor of any window splitting. The second is the 'frame-windows-min-size' code that takes care of the entire frame layout in an equal fashion for GUI frames and TTY frames. In either case we do not shrink the dimensions of our windows but keep them as in the GUI example above. > Also, I'd be happier if you could describe the sequence of > events that lead to frame and window resizing following a SIGWINCH. IIUC we call change_frame_size, possibly delay it, and eventually call adjust_frame_size just as we do for GUI frames. There's no special magic involved. The problematic thing I see is that the entire cursor wrapping code including the check in cmcheckmagic seem botched because when a window is virtually drawn below the border of the terminal window (as in the GUI example sketched above) we do not check whether the cursor ends up below that border too. In particular the form /* First the degenerate case */ if (row == curY (tty) && col == curX (tty)) /* already there */ return; in cmgoto seems to indicate that we leave the cursor at its current location. Maybe we do that even earlier, for example, in if (curY (tty) == vpos && curX (tty) == hpos) return; of tty_cursor_to. And maybe neither of these is relevant because redisplay simply does nothing if the size of the root window does not change (I wouldn't know where and how redisplay checks that). At the very end the check in cmcheckmagic aborts us in any such case. martin