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#56102: 29.0.50; fit-frame-to-buffer's window-text-pixel-size calculation can be incorrect when only is set to vertically Date: Thu, 23 Jun 2022 09:30:26 +0200 Message-ID: <0807c810-af05-f92c-17ce-991056906629@gmx.at> References: <834k0ckdet.fsf@gnu.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------iY0tfU4h4cbkLiLpZgYAUF9z" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="8064"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 56102@debbugs.gnu.org To: Aaron Jensen , Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Jun 23 09:31: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 1o4HJB-0001vG-Qb for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 23 Jun 2022 09:31:21 +0200 Original-Received: from localhost ([::1]:50582 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o4HJA-0000UI-MG for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 23 Jun 2022 03:31:20 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:50858) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o4HIs-0000S1-Gm for bug-gnu-emacs@gnu.org; Thu, 23 Jun 2022 03:31:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:43233) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o4HIs-0003Q7-7e for bug-gnu-emacs@gnu.org; Thu, 23 Jun 2022 03:31:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1o4HIs-0005Wz-53 for bug-gnu-emacs@gnu.org; Thu, 23 Jun 2022 03:31: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, 23 Jun 2022 07:31:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 56102 X-GNU-PR-Package: emacs Original-Received: via spool by 56102-submit@debbugs.gnu.org id=B56102.165596943921230 (code B ref 56102); Thu, 23 Jun 2022 07:31:02 +0000 Original-Received: (at 56102) by debbugs.gnu.org; 23 Jun 2022 07:30:39 +0000 Original-Received: from localhost ([127.0.0.1]:37130 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1o4HIU-0005WM-VF for submit@debbugs.gnu.org; Thu, 23 Jun 2022 03:30:39 -0400 Original-Received: from mout.gmx.net ([212.227.17.20]:33305) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1o4HIR-0005W5-DT for 56102@debbugs.gnu.org; Thu, 23 Jun 2022 03:30:37 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1655969428; bh=zgIA5Le6ytrnUOgMB9ILT/tYtzZPg8ox/jzxGQ4x8K8=; h=X-UI-Sender-Class:Date:Subject:To:Cc:References:From:In-Reply-To; b=OR1jIqFIWUuyYlW3H6qOguGKiRfSipJBC1AxV6xOqFAiyw0AorYMF5aO0FhJRp3kE iYGLeElEE0hBMf7mj1kND2oJDEWUl+A2X42r1QxPK5+5eJkkWvp9JtW0KHGsyhDQ5o 3s+0yatfzwRVJ1jrAtt4shQC5hPBRHL86RFGVFaE= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Original-Received: from [192.168.1.101] ([46.125.249.16]) by mail.gmx.net (mrgmx104 [212.227.17.168]) with ESMTPSA (Nemesis) id 1Mzyuc-1nhuaI0Q1m-00x2ll; Thu, 23 Jun 2022 09:30:28 +0200 Content-Language: en-US In-Reply-To: X-Provags-ID: V03:K1:bLrxGIFkZG0RrCuX+hoKnS9idH/y4gmkVsPtd1dKRk4OEkvQ+Ba wh3b/Mi3gC8Ob7B/7Uv1zNfL2pIMWPBs/kxazJRUj3q+Oekw1mFIpKX05pgnKSxv5eUu1xK r5sZKDunjhVsEWzXT2u4GF7JCZEcCQNckLePjThCIvBikxEcOKiHCKRtGA2KqEdLZqOBuNR UdolamnrUYzkV6mO98giw== X-UI-Out-Filterresults: notjunk:1;V03:K0:Aq7xCld6ltY=:HIEG9f5sIfo7yGz1LvuG5P 7at5yrwtY6DigyX0DuRWhR89xIy4/KOo4ZaK04brT3MFrnT7YxE8TFU4nUwijuXEJomwXhPFD fheaITs/AbJ8RRrQWzG4nAgRDXmEYUO3RFuhZxzC/DX2PpgqTHhwtjT9mbheGdQFw+NCMHc02 5qqa3WCvNE2pYzUnBNIjWUGZjMD3GhcA2PXswuYuN+9f8j+XLEq5pCMEDPQqqj0yaH9NKoUAN I6oikyy106cFgH0gSS8tq/QmTRrW2zMNyjbZc14tM5iBPtpWdVrohz9UgOBJeQmKL2iRMMWpz CKDX5vdbDMfmvL7OXr7BXqJcuyiGbKjebHsCQ7VXTPm1MGe4dmSLTE0i45jJ3KStryU7/rd+i l6wAOBZL2jko2VpCdXyDE7P1q0K47a9am/A/0HHN1comZOXlOX2ssrNUJSMM7Mi8+jWpMwMip aRFlD3PabWV9Bu2BwLeW/ss2nA4DXk4pMw5hFUUn7n/4SbNGnBbTPVqqp/agNc89J5mg2C1JU GVnPRMy9HiQcdjIpx9bDyZvKG111K9ZRbBio3CwkhVIWRwp6UWsOQjHcW6gYet9JeyFJ3oDja ZOCAd2g4wcAI4puesUOlDcrwn+VoY6rqxUrW0fwoQDTq+6e5IlJ0yj4y3iiJp8jDd6rg8sq4f Uah77xQM2SEgHh3XkbRLmCQ6BmXvTB77cFzEpe4IN73y0+Xn4gFwwpfpnva0iqzt6BmYVPMZb KqGgibtToZle8dYthsyYf1fvr0yYBCM3slcYitKo4reEFi68NXg9EI/dx7hVa4OFrGPW3rWR 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:235070 Archived-At: This is a multi-part message in MIME format. --------------iY0tfU4h4cbkLiLpZgYAUF9z Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit >>> The problem appears to be the lines: >>> >>> (size >>> (window-text-pixel-size window from to max-width max-height)) >>> >>> As the max-width will be larger than the current frame (meaning the >>> height calculation will not take wrapping into account). I think MAX-WIDTH should be nil here. >>> One possible fix is to set min/max height/width based on `only' to >>> (frame-parameter frame 'width) / (frame-parameter frame 'height) but I >>> do not know if that is the best fix. This would not work. The 'height' frame parameter counts in characters while 'window-text-pixel-size' wants pixels as X-LIMIT. Also, the sizes of frame and window decorations would hardly match. >>> If that is done, then it may be possible to remove the rest of the >>> special handling for `only' that sets width/height to nil and handles that. >> >> I think you're right, but I'd like to hear if Martin has any comments. > > Sounds good. The most minimal change I can think of is to use the > current frame's width as max-width in the window-text-pixel-size call > when only is set to vertically. I don't know of any reason we need to > constrain max-height in that call because it doesn't have the same > impact. That can be done either explicitly in that call or by changing > max-width to be set to the current width as I described before. That > would be asymmetrical with max-height though, which would be rather > confusing IMO. Please try the attached diff. Thanks, martin --------------iY0tfU4h4cbkLiLpZgYAUF9z Content-Type: text/x-patch; charset=UTF-8; name="fit-frame-to-buffer.diff" Content-Disposition: attachment; filename="fit-frame-to-buffer.diff" Content-Transfer-Encoding: base64 ZGlmZiAtLWdpdCBhL2xpc3Avd2luZG93LmVsIGIvbGlzcC93aW5kb3cuZWwKaW5kZXggMWI4 ZmUyYjI2Mi4uN2I4Y2E4N2Y2YSAxMDA2NDQKLS0tIGEvbGlzcC93aW5kb3cuZWwKKysrIGIv bGlzcC93aW5kb3cuZWwKQEAgLTkzODIsMTQgKzkzODIsMTcgQEAgZml0LWZyYW1lLXRvLWJ1 ZmZlci0xCiAgICAgICAgICAgICAgKChudW1iZXJwIChudGggMSBzaXplcykpICgqIChudGgg MSBzaXplcykgbGluZS1oZWlnaHQpKQogICAgICAgICAgICAgICh0ICh3aW5kb3ctbWluLXNp emUgd2luZG93IG5pbCBuaWwgdCkpKSkKICAgICAgICAgICAgKG1heC13aWR0aAotICAgICAg ICAgICAgKG1pbgotICAgICAgICAgICAgIChjb25kCi0gICAgICAgICAgICAgICgobnVtYmVy cCBtYXgtd2lkdGgpICgqIG1heC13aWR0aCBjaGFyLXdpZHRoKSkKLSAgICAgICAgICAgICAg KChudW1iZXJwIChudGggMiBzaXplcykpICgqIChudGggMiBzaXplcykgY2hhci13aWR0aCkp Ci0gICAgICAgICAgICAgICh0IHBhcmVudC1vci1kaXNwbGF5LXdpZHRoKSkKLSAgICAgICAg ICAgICA7OyBUaGUgZm9sbG93aW5nIGlzIHRoZSBtYXhpbXVtIHdpZHRoIHRoYXQgZml0cyBp bnRvIHRoZQotICAgICAgICAgICAgIDs7IGxlZnQgYW5kIHJpZ2h0IG1hcmdpbnMuCi0gICAg ICAgICAgICAgKG1heCAoLSByaWdodC1tYXJnaW4gbGVmdC1tYXJnaW4gb3V0ZXItbWludXMt Ym9keS13aWR0aCkpKSkKKyAgICAgICAgICAgIChsZXQgKChtYXgtd2lkdGgKKyAgICAgICAg ICAgICAgICAgICAoY29uZAorICAgICAgICAgICAgICAgICAgICAoKG51bWJlcnAgbWF4LXdp ZHRoKSAoKiBtYXgtd2lkdGggY2hhci13aWR0aCkpCisgICAgICAgICAgICAgICAgICAgICgo bnVtYmVycCAobnRoIDIgc2l6ZXMpKSAoKiAobnRoIDIgc2l6ZXMpIGNoYXItd2lkdGgpKQor ICAgICAgICAgICAgICAgICAgICAoKG5vdCAoZXEgb25seSAndmVydGljYWxseSkpIHBhcmVu dC1vci1kaXNwbGF5LXdpZHRoKSkpKQorICAgICAgICAgICAgICAod2hlbiAobnVtYmVycCBt YXgtd2lkdGgpCisgICAgICAgICAgICAgICAgKG1pbiBtYXgtd2lkdGgKKyAgICAgICAgICAg ICAgICAgICAgIDs7IFRoZSBmb2xsb3dpbmcgaXMgdGhlIG1heGltdW0gd2lkdGggdGhhdCBm aXRzCisgICAgICAgICAgICAgICAgICAgICA7OyBpbnRvIHRoZSBsZWZ0IGFuZCByaWdodCBt YXJnaW5zLgorICAgICAgICAgICAgICAgICAgICAgKG1heCAoLSByaWdodC1tYXJnaW4gbGVm dC1tYXJnaW4KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgb3V0ZXItbWludXMtYm9k eS13aWR0aCkpKSkpKQogICAgICAgICAgICAobWluLXdpZHRoCiAgICAgICAgICAgICAoY29u ZAogICAgICAgICAgICAgICgobnVtYmVycCBtaW4td2lkdGgpICgqIG1pbi13aWR0aCBjaGFy LXdpZHRoKSkK --------------iY0tfU4h4cbkLiLpZgYAUF9z--