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#70894: [PATCH] * lisp/window.el (fit-window-to-buffer): Fix width calculation Date: Sun, 19 May 2024 11:09:29 +0300 Message-ID: <86le46b4ue.fsf@gnu.org> References: <86jzjre9xh.fsf@gnu.org> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="19371"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Morgan.J.Smith@outlook.com, 70894@debbugs.gnu.org To: martin rudalics Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun May 19 10:10:16 2024 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 1s8bcW-0004oX-HK for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 19 May 2024 10:10:16 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s8bcG-00028u-Jg; Sun, 19 May 2024 04:10:00 -0400 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 1s8bcE-00028j-Fw for bug-gnu-emacs@gnu.org; Sun, 19 May 2024 04:09:58 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1s8bcE-0006QA-7L for bug-gnu-emacs@gnu.org; Sun, 19 May 2024 04:09:58 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1s8bcI-00028E-32 for bug-gnu-emacs@gnu.org; Sun, 19 May 2024 04:10: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: Sun, 19 May 2024 08:10:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 70894 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 70894-submit@debbugs.gnu.org id=B70894.17161061838176 (code B ref 70894); Sun, 19 May 2024 08:10:02 +0000 Original-Received: (at 70894) by debbugs.gnu.org; 19 May 2024 08:09:43 +0000 Original-Received: from localhost ([127.0.0.1]:35853 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1s8bby-00027o-JM for submit@debbugs.gnu.org; Sun, 19 May 2024 04:09:42 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:55176) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1s8bbx-00027i-AP for 70894@debbugs.gnu.org; Sun, 19 May 2024 04:09:42 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1s8bbn-0006P2-Ay; Sun, 19 May 2024 04:09:31 -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=C0uUCcCQnHuRAGIcl0W8o5YDdVv8/W97+FEG3vCYFcg=; b=mL2qa9yf0s81 vS+g9QEwCTG9C/njp4pJhJgS8/VUo0mm8FEoxgW65DexvgsIy4ABjkhvOCBdfBWoFqA85lS7QBDcX 6aMyGj0yYQYQ8aviQLG0TJCJdfOMw0Iw1u+yOqf15i09QMJkmmEsdsl3Ex2aCRchaoi38V9hPTHk3 zB1j6cdBwqV5Jj7hGWFKA/73KHUXJ5z64x1A6qmP7LWhfo3u6KKBNW2Z4/spOQbzA+1VLPtpzDJyb lP5xEKPs3sDUr0VrqKyeo65kj9DfLnBinc0A7v/LLUj56s3qbF5BPAi/z2hIf7+ny/+fGluR413E/ s5KfboN1rRiRQxodVJUYhQ==; In-Reply-To: (message from martin rudalics on Sun, 19 May 2024 09:58:58 +0200) 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:285413 Archived-At: > Date: Sun, 19 May 2024 09:58:58 +0200 > Cc: 70894@debbugs.gnu.org > From: martin rudalics > > > Martin, any comments? > > Looks good to me. Principally, instead of subtracting the sizes of the > decorations from the initial total width and re-adding them later, they > should have been added to the calculated pixel width as is done when > fitting the height. OK, I installed the patch on master now, thanks. > But mildly spoken, 'fit-window-to-buffer' is a complete mess in the > first place. Calculating sizes in terms of lines/columns doesn't make > sense. If really necessary - minibuffer resizing, for example, does not > care - results should be rounded in a final step. Also, I doubt that > both char-width and char-height are calculated reasonably when buffer > text is scaled or line spacing changed. For the last issue: we should use default-font-width/height. But the question is: would replacing frame-char-width/height by these two fix that use case, or do we need anything else?