From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii 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: Wed, 22 Jun 2022 16:58:50 +0300 Message-ID: <834k0ckdet.fsf@gnu.org> References: Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="5470"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 56102@debbugs.gnu.org To: Aaron Jensen , martin rudalics Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Jun 22 16:01:52 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 1o40vW-0001B9-Q2 for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 22 Jun 2022 16:01:50 +0200 Original-Received: from localhost ([::1]:56410 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o40vV-0006Yg-9p for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 22 Jun 2022 10:01:49 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:52226) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o40tm-00064Y-Sh for bug-gnu-emacs@gnu.org; Wed, 22 Jun 2022 10:00:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:42287) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o40tm-0000zj-GI for bug-gnu-emacs@gnu.org; Wed, 22 Jun 2022 10:00:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1o40tm-00020o-F3 for bug-gnu-emacs@gnu.org; Wed, 22 Jun 2022 10:00:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 22 Jun 2022 14:00: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.16559063477643 (code B ref 56102); Wed, 22 Jun 2022 14:00:02 +0000 Original-Received: (at 56102) by debbugs.gnu.org; 22 Jun 2022 13:59:07 +0000 Original-Received: from localhost ([127.0.0.1]:36184 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1o40st-0001zD-He for submit@debbugs.gnu.org; Wed, 22 Jun 2022 09:59:07 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:38856) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1o40sr-0001yK-35 for 56102@debbugs.gnu.org; Wed, 22 Jun 2022 09:59:05 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:42276) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o40sl-0000tH-J4; Wed, 22 Jun 2022 09:58:59 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=4oarLxEm8dzXXM6QBk9h97OubfPUAXhKzrZyUKZDHR0=; b=rF3SxxUi+NJD sodjtjjvMOOtqaqrOCp3edRtAWQPjZMY/LGUepK6de0En8O+6voJEQYCnLtxg4GxMCtVoDhRaZ+A8 iWwNK2FZYzvYCCeY2cMSkQvqO0EcNpQi7wmIEZbWK+Am/XJgPXQm99Z9PqqkxfTGvsJm/7rPUI7nL Z986b0H0qIpKkVJO0Tkqu4KCrWKQuhsjwxCgkKjNjH9cC2a364wcK0Y6T+S2Qf2Y4L+KFAqfgFW6W tJtkcG0zlnmATwIyNkxnEbWJpeyw+qVJ5ICB5/wXumKMv7BLPXDO82z5rzkqkDszyTlnl0/CxTN5x gm98sPSHhF/T616BLkQVIg==; Original-Received: from [87.69.77.57] (port=3861 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o40sl-0000wB-1h; Wed, 22 Jun 2022 09:58:59 -0400 In-Reply-To: (message from Aaron Jensen on Sun, 19 Jun 2022 23:03:14 -0400) 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:235024 Archived-At: > From: Aaron Jensen > Date: Sun, 19 Jun 2022 23:03:14 -0400 > > > To repro, open emacs -Q and resize your frame so that the ";; This > buffer..." text wraps (this repro assumes your monitor has more than > enough space for it to not wrap if the frame was big enough). > > Add a few more lines of text and then: > > M-: (fit-frame-to-buffer nil nil nil nil nil 'vertically) > > You should see that the frame's height is too short and does not contain > all the lines. It contains one fewer line for each wrapped line. > > Screenshots: > > https://share.cleanshot.com/huexHe > https://share.cleanshot.com/dnhKex > > 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). > > 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. > > 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. Thanks.