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: Wed, 22 Jun 2022 10:15:17 -0400 Message-ID: References: <834k0ckdet.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="2563"; mail-complaints-to="usenet@ciao.gmane.io" Cc: martin rudalics , 56102@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Jun 22 16:16:34 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 1o419l-0000QJ-T6 for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 22 Jun 2022 16:16:33 +0200 Original-Received: from localhost ([::1]:36022 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o419k-0004Qd-BK for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 22 Jun 2022 10:16:32 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:55676) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o419H-0004QO-Vz for bug-gnu-emacs@gnu.org; Wed, 22 Jun 2022 10:16:04 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:42310) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o419G-0003ff-Bp for bug-gnu-emacs@gnu.org; Wed, 22 Jun 2022 10:16:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1o419G-0002Pp-3G for bug-gnu-emacs@gnu.org; Wed, 22 Jun 2022 10:16:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Aaron Jensen Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 22 Jun 2022 14:16: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.16559073469261 (code B ref 56102); Wed, 22 Jun 2022 14:16:02 +0000 Original-Received: (at 56102) by debbugs.gnu.org; 22 Jun 2022 14:15:46 +0000 Original-Received: from localhost ([127.0.0.1]:36207 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1o418p-0002P8-KB for submit@debbugs.gnu.org; Wed, 22 Jun 2022 10:15:45 -0400 Original-Received: from mail-pf1-f179.google.com ([209.85.210.179]:42700) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1o418o-0002Oi-9W for 56102@debbugs.gnu.org; Wed, 22 Jun 2022 10:15:35 -0400 Original-Received: by mail-pf1-f179.google.com with SMTP id d17so7272437pfq.9 for <56102@debbugs.gnu.org>; Wed, 22 Jun 2022 07:15:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=E9hwi/7DnfAGoguY24goonZtJId71srDkamcZoi6FSg=; b=GCcpuU1EajVOP4/K5FG61lz8gRsDzRM+KbRoFP3vpN68hh/Pdo6DH9e9z9fslDVIuU hq4kq99I423u72yKZGyVIZyTgcjwCcNxjZMi7uBKqYmtkE52xKAlwpEkoKg93C7BiZNq DF3z3iSIzpvKF7UI+/l8tGLDkIDAkQZ5/v4/LIkuxyc3Yri6Etosb6y5Qdw+633/8PNP XuWg04Ovh+kPjK74glqSWYD1fbOBrN7B7O/EqcMp2B5cEU9Vx0JLEztQQZfDfPbOd8iG 7j6jKCIEKm8LKlAxThjnhuJQVHjpXNXLfrW/guAYojOQX/a/yFCYZiIud3C+Eun6TQFP Jlfw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=E9hwi/7DnfAGoguY24goonZtJId71srDkamcZoi6FSg=; b=KFjleNmKuN444BZL53bjQMaDNEW4tsuiOSD8aA7e2aqywrKun5paG/w6mm3zTanoiL rfQY4aQoUuKSrwd+GGA8vWbteTDKy8kkGNWaAgCIqHIbh0Cdn4q1BvqQTXht0Ohm5qJB shxxzKxT1xq705OTM113lXvFDxPTS+iWdkXEdxLak3RR7en3nwTbNphpcDckaBBW0IhY GR+wyeV7UCP4FUSy/9Z8V0K4PF8LP1rCj3KWq0Q3L2ZA4nNnyUdtwOisAZlFXCdOxwA8 BibH9jWa1nLUw5Mz5GU99COrELCuxSc7tM26nTJYVF3m2aRsI4A+3AOdC7438pQH6L40 i5mg== X-Gm-Message-State: AJIora/dUWnxh4EopivQFr/JDD/jVqtf1OR712odgGiswnOUnsN53cvy 28dEXFS3Wuc4xZ063SsUcIAv8g3C48RjtMNHnHE= X-Google-Smtp-Source: AGRyM1uNpGHR4DOwubmbombcospu/iTRCU44+FxdKppZPz8X8c38b1ZVfUJ22qk/muJATjs8tMKm5xHSIOyBt90XhYI= X-Received: by 2002:a63:5906:0:b0:401:9ade:d138 with SMTP id n6-20020a635906000000b004019aded138mr3109552pgb.520.1655907328456; Wed, 22 Jun 2022 07:15:28 -0700 (PDT) In-Reply-To: <834k0ckdet.fsf@gnu.org> 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:235027 Archived-At: On Wed, Jun 22, 2022 at 9:59 AM Eli Zaretskii wrote: > > > 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. 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. Aaron