From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Aaron Jensen 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: Sun, 19 Jun 2022 23:03:14 -0400 Message-ID: Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="21775"; mail-complaints-to="usenet@ciao.gmane.io" To: 56102@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Jun 20 05:04:11 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 1o37hz-0005S6-5w for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 20 Jun 2022 05:04:11 +0200 Original-Received: from localhost ([::1]:57236 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o37hx-00064u-Mo for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 19 Jun 2022 23:04:09 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:39642) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o37hs-00064l-KI for bug-gnu-emacs@gnu.org; Sun, 19 Jun 2022 23:04:04 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:59739) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o37hq-00055D-1V for bug-gnu-emacs@gnu.org; Sun, 19 Jun 2022 23:04:04 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1o37hp-0004c3-PV for bug-gnu-emacs@gnu.org; Sun, 19 Jun 2022 23:04:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Aaron Jensen Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 20 Jun 2022 03:04:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 56102 X-GNU-PR-Package: emacs X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.165569420417681 (code B ref -1); Mon, 20 Jun 2022 03:04:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 20 Jun 2022 03:03:24 +0000 Original-Received: from localhost ([127.0.0.1]:53636 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1o37hE-0004b7-FS for submit@debbugs.gnu.org; Sun, 19 Jun 2022 23:03:24 -0400 Original-Received: from lists.gnu.org ([209.51.188.17]:36500) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1o37hA-0004aw-Jw for submit@debbugs.gnu.org; Sun, 19 Jun 2022 23:03:23 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:39590) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o37hA-00062o-ED for bug-gnu-emacs@gnu.org; Sun, 19 Jun 2022 23:03:20 -0400 Original-Received: from mail-qv1-xf34.google.com ([2607:f8b0:4864:20::f34]:38714) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o37h8-0004t2-9T for bug-gnu-emacs@gnu.org; Sun, 19 Jun 2022 23:03:19 -0400 Original-Received: by mail-qv1-xf34.google.com with SMTP id p31so14268786qvp.5 for ; Sun, 19 Jun 2022 20:03:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:subject:date:message-id:mime-version; bh=WzWEuMMtqgx8g3iSioCmxe6wRibq9AWKcn+6fq9iPHo=; b=HoEo5ag283KIZdnNRf9eM3UuSac6FRMLydNBKkYj7D/7YsGbVp9bnFDqNrlomzEsLq fuDOrGnkbcOJoG/k4gsqcDE//xyjRMkdIkzyUQAM1SVu1DLKBR6WPX8s/KGhYKJ84vNw rHo08LE9SFONg4Ud+ZCtEt3Z37jKC2xYYSluRJTBL5ZymdjCR6FZGsc58sSVezNxDejK ApJr9qrQ7SK4+2VrFKmtjZISHXzEJzxmDmxttiwoYQzTTAt9r/gXmL95a0LKui4XJOH0 HLgL32xhiyBe9NjO8EKB0xczfq/xciv6JXCT+vJhrq73ahScZ/G1/nLReAePs5yOEriP YP5g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:mime-version; bh=WzWEuMMtqgx8g3iSioCmxe6wRibq9AWKcn+6fq9iPHo=; b=EsR9loEzawcL/HBGATzx8g0nIq/d4/N7JuS01Uf/5yrQcPcqU/xGaFdc2iH7Mpzptc STJXaZtE7d+T81Ao0sTLYrjGB3Vpm9wRrr9HNGuOIMcwmRQFcpBBvqOTNtedOqoz83+t RPozv06Jv+d19k4zhl06q2PqICRlTSkwvm4EgeBQPCAhw/W7XzNKqkg3Hn5e1rDQNetS LfkTvHGYba/GAPENa5Gw7NTJz0LgwWfXJVDTB1FO+goFa86xNhQPy8IfnrJ6X/3cy+o+ hRM5xG7gF8xtGf77SYVVM/0zRJ1NZuWwC41+XQCAzbelZHIq9tskDc4TCL8rw2WEBftw vsBQ== X-Gm-Message-State: AJIora9CNxx1ENMJfui1aqbxV5XpeDwQ1a3SJQ/UyyZadA2RYk/6KXGL CEmzWt1evoFtRG7knvyHxXBnxOcFKog= X-Google-Smtp-Source: AGRyM1snnbTCEKrS7F07GTrCw1GtamBBPpAJw5ixwnTiG2urvQf7dLnWeP/gCstj0oLvKajr8ZaFJQ== X-Received: by 2002:ad4:5d49:0:b0:46a:66a2:d73f with SMTP id jk9-20020ad45d49000000b0046a66a2d73fmr17421408qvb.45.1655694196527; Sun, 19 Jun 2022 20:03:16 -0700 (PDT) Original-Received: from aaron-m1.local ([71.215.162.245]) by smtp.gmail.com with ESMTPSA id i3-20020a05620a248300b0069fc13ce23dsm11432880qkn.110.2022.06.19.20.03.15 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 19 Jun 2022 20:03:15 -0700 (PDT) Received-SPF: pass client-ip=2607:f8b0:4864:20::f34; envelope-from=aaronjensen@gmail.com; helo=mail-qv1-xf34.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action 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:234843 Archived-At: 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. In GNU Emacs 29.0.50 (build 1, aarch64-apple-darwin21.5.0, NS appkit-2113.50 Version 12.4 (Build 21F79)) of 2022-05-30 built on aaron-m1.local Windowing system distributor 'Apple', version 10.3.2113 System Description: macOS 12.4