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#59547: 28.2; The bottom border is not displayed when setting the pixel height of a child frame smaller than 1 line Date: Mon, 28 Nov 2022 11:27:17 +0100 Message-ID: <57b46e7e-e1fd-774b-f39c-e55e9782398b@gmx.at> References: 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="6212"; mail-complaints-to="usenet@ciao.gmane.io" To: Yuwei Tian , 59547@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Nov 28 11:28:23 2022 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 1ozbN8-0001SP-Ub for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 28 Nov 2022 11:28:23 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ozbMs-0004ON-Hf; Mon, 28 Nov 2022 05:28:06 -0500 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 1ozbMo-0004Lx-5y for bug-gnu-emacs@gnu.org; Mon, 28 Nov 2022 05:28:03 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ozbMn-0006tb-PW for bug-gnu-emacs@gnu.org; Mon, 28 Nov 2022 05:28:01 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1ozbMn-0000FU-LD for bug-gnu-emacs@gnu.org; Mon, 28 Nov 2022 05:28:01 -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, 28 Nov 2022 10:28:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 59547 X-GNU-PR-Package: emacs Original-Received: via spool by 59547-submit@debbugs.gnu.org id=B59547.1669631249948 (code B ref 59547); Mon, 28 Nov 2022 10:28:01 +0000 Original-Received: (at 59547) by debbugs.gnu.org; 28 Nov 2022 10:27:29 +0000 Original-Received: from localhost ([127.0.0.1]:47734 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ozbMG-0000FE-PW for submit@debbugs.gnu.org; Mon, 28 Nov 2022 05:27:29 -0500 Original-Received: from mout.gmx.net ([212.227.15.19]:48445) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ozbME-0000Es-LQ for 59547@debbugs.gnu.org; Mon, 28 Nov 2022 05:27:27 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.at; s=s31663417; t=1669631239; bh=xkfoN/4HvGfciB2+JVl6TD97qSeDLE/MEZwo84M2k9Y=; h=X-UI-Sender-Class:Date:Subject:To:References:From:In-Reply-To; b=JA/8ro2oYnwrJ2vdOnCkxB5tApeLCNNoR+ClVK46++oBziDRMMPuhsXaqTwnBPie6 jdSOnUVH8+65w7xp+Up4sRYgzGV2L1kkwvHbmIi97ItdnkqEWQhF8XL0UY6qo27+YD 4D/FJpAej4WLLnCPl4G3lYUFVCCrEoUxOv+RB6KD42vvfaI+HxabyNfjqmvUQLgOcD asEIVaq7dWjEky/D7gqOPcIpvbWDRj5jnYZz+UzQj4XJwabaUz29q8tG3wFK3y5STv RD9OVAsNTfM47Dem0TSSXYjRMR++EEUU8vnCsE0t7NF4SbocpZMGx9qc1pUwHDvPP1 EPeV6L5HZ2PZg== X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a Original-Received: from [192.168.1.100] ([213.142.97.105]) by mail.gmx.net (mrgmx005 [212.227.17.190]) with ESMTPSA (Nemesis) id 1MZTqW-1pTy5Z2YCM-00WWEN; Mon, 28 Nov 2022 11:27:19 +0100 Content-Language: en-US In-Reply-To: X-Provags-ID: V03:K1:FPd6A63NISI16XScyEfrhh6wspjVU1UlCktvp/o9HmU3WHSx3Vw o5VF08/txQlNpjy+Tuj224cqTIHIoBcAhsixGlO9MVUgtcSq5gqwIl3hNZwrr/NNdjIDyFl znvv5YsVm2OR8uxh2MdvKRM74SaiY3vpCQj7mytRZahvwMyUEMDgS8rGeAnV4r58gaS0yJ1 jSGsjTRQ1w9v9JRYxiCVQ== UI-OutboundReport: notjunk:1;M01:P0:8PWE15CQo8A=;DRkrePrY7BzaqBCoktHdM4uc4FV TEiyelC0SstH9FOLWL0oLEF5Il0q43djt1/izOguu7lBz9/1XlKZyahN1mu2CAKn3eQD5vMWR 16tA71WUeNWm62PjPS2/0URMq4z+b4iwiDWDs5ve+rarbTPLgbYSlqQBXb2AR6CrtS0DKJYZ/ NWib8pE+PmsFw2E98lMVWsGwb2/RlybXb5repOMgJzZWK1IWGfh6km1slnr64B2IWijuzpRoG NrLYa9nQ+55eq6arqTfVhSJ7o2VZ1U4DWCVo/YwBBrv94VI5yADKHtnChObn9GFfzIo68ouNP TLNjb3ordKm542Zr/HUqhKXugKOtPQyAcQYs7ezo5L4sZK2wJ2QNZ9ysDbo+a5jrP6L82biUe vKMHAE4CpLFQVMYnBJLBMUzsURXy7m0LaiLE9oSNsGWAKYfq9gvNsWkJI5yVwO/gN0cmp0T2i mn5WiJW/ELkEUQqUWEXdcXOgEaZUT73fFcxdf2gKb2epKI438zcJho+4iJHMPR1Fhmx6Z4v4p Xm+dS2qXHlCNXAzjmmtWVzMC7bXfFouNtODlkmlbX7wsXPJEdchJmH/LkLBpO65C9nYJOeNqw u6e63NabtuUgy7TxGQbY9pn/yNo9dFU0Mtto69n6se5KUOpTd6maNqRzr0pFfXuqYmDnTQKim jHrp9AuXqyDW6mQCUoLgJwIAvvX0H2Lk7tUtQ6BvbRuAN8u5tUOXgcjjtG2dHcO0IdlwhQghi Y+w0QwU2LexEb++pQTnSwTsxHakcJUGui8seOd8Zu/db5FgeM6qrhbaFEnorEk/lNh0wGkVd 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:249278 Archived-At: > Start Emacs from 'Emacs -Q' and make a child frame with the following > code: > > (let ((window-min-height 1) > (window-min-width 1)) The last line is problematic since 'window-safe-min-width' being 2 will override it. > (fit-frame-to-buffer my-child-frame) > (let ((window-min-height 0) > (window-safe-min-height 0)) > (set-frame-size my-child-frame > (frame-pixel-width my-child-frame) > (floor (* 0.5 (frame-pixel-height my-child-frame))) > t))) This is overly complicated. (let ((window-min-height 0) (window-safe-min-height 0)) (set-frame-size my-child-frame 50 8 t))) suffices to show the problem here. In either case, you do two things which most people would classify as pilot errors. - You bind 'window-safe-min-height' which is defined as a constant variable and according to the doc-string of 'defconst' "neither programs nor users should ever change the value". - You temporarily bind 'window-min-height' around the 'set-frame-size' call which means that it may not affect future resize operations on 'my-child-frame' or its windows. In particular, it may not affect the frame size adjustment triggered by 'set-frame-size' itself if that happens asynchronously (not within the scope of 'set-frame-size'). > The bottom border of the child frame is not displayed. Try to resize the > child frame again: > > (let ((window-min-height 0) > (window-safe-min-height 0)) > (set-frame-size my-child-frame 50 8 t)) > > And select other window, then the bottom border of the child frame appears. Here clicking into the child frame with the mouse suffices to make the bottom border appear. > This behavior seems to be platform dependent, but it is indeed > problematic. It also seems to have problems on Emacs 28, Linux/X11. The immediate cause of the problem are these two lines in window.c's resize_frame_windows code: new_pixel_size = max (horflag ? size : size - mini_height, unit); new_size = new_pixel_size / unit; where unit is defined as int unit = horflag ? FRAME_COLUMN_WIDTH (f) : FRAME_LINE_HEIGHT (f); As a consequence, 'compute_line_metrics' in xdisp.c will calculate max_y = WINDOW_BOX_HEIGHT_NO_MODE_LINE (it->w); if (row->y + row->height > max_y) row->visible_height -= row->y + row->height - max_y; from the value of 'unit' above, the text is not clipped and whether you see the lower border or the lower part of the buffer text reduces to the question of who succeeds in drawing later into that area - the code displaying the buffer text or the one filling the border rectangle. If you replace these two lines with say new_pixel_size = max (horflag ? size : size - mini_height, 1); new_size = max (new_pixel_size / unit, unit); you should get the bottom border immediately. Whether applying such a "fix" is safe, is a question I cannot answer though. Here I'm living happily with fixes for this and many related problems but have no hope that they will ever see the light of master. martin