From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: martin rudalics via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#70894: [PATCH] * lisp/window.el (fit-window-to-buffer): Fix width calculation Date: Sun, 19 May 2024 09:58:58 +0200 Message-ID: References: <86jzjre9xh.fsf@gnu.org> Reply-To: martin rudalics Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="10398"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla Thunderbird Cc: 70894@debbugs.gnu.org To: Eli Zaretskii , Morgan Smith Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun May 19 10:00:21 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 1s8bSv-0002Tj-Dw for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 19 May 2024 10:00:21 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s8bSZ-0000yg-SR; Sun, 19 May 2024 03:59:59 -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 1s8bSZ-0000yY-Bn for bug-gnu-emacs@gnu.org; Sun, 19 May 2024 03:59:59 -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 1s8bSZ-0004KY-3j for bug-gnu-emacs@gnu.org; Sun, 19 May 2024 03:59:59 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1s8bSc-000200-UQ for bug-gnu-emacs@gnu.org; Sun, 19 May 2024 04:00: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: Sun, 19 May 2024 08:00: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.17161055547635 (code B ref 70894); Sun, 19 May 2024 08:00:02 +0000 Original-Received: (at 70894) by debbugs.gnu.org; 19 May 2024 07:59:14 +0000 Original-Received: from localhost ([127.0.0.1]:35843 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1s8bRq-0001z5-4G for submit@debbugs.gnu.org; Sun, 19 May 2024 03:59:14 -0400 Original-Received: from mout.gmx.net ([212.227.15.15]:58787) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1s8bRo-0001yz-Do for 70894@debbugs.gnu.org; Sun, 19 May 2024 03:59:13 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmx.at; s=s31663417; t=1716105539; x=1716710339; i=rudalics@gmx.at; bh=uJoPOoA6HzJsemxNZ+MN2YL1ha+/8APcuQN4LHQfjas=; h=X-UI-Sender-Class:Message-ID:Date:MIME-Version:Subject:To:Cc: References:From:In-Reply-To:Content-Type: Content-Transfer-Encoding:cc:content-transfer-encoding: content-type:date:from:message-id:mime-version:reply-to:subject: to; b=hNS0JeAox6GZfcdG+D0YvcpwF8HISG9o6M1j7YEyMDYfqQ1gZqhIPYjTU8ixoHzA iJdhxf3NKu4Izx+APmrAviWeDwRQvHVsAvU2kzKDIfsv4uFsEyf2Ba8FvsDYrqGRi nV6gtNa3W1Zf3MzjhrGxLlnzkwN6M20APdk3urCGDrsX7pZjeh4KsBw1aRXTWPZG9 dngBfiAxZfqYWBpFhU6lMrS4iGgWMYGrYVe+XM5v8XJRtvmZnkEfJchrU8bo1vITV rOOLAQzR+cDVnK7WoN4on7yzf03kOqsuRUFq/8yaYeU31uE1wcY8FBZHh/qQAhCFj qiDWXlOQ2oseBKrFFA== X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a Original-Received: from [192.168.31.113] ([46.125.249.126]) by mail.gmx.net (mrgmx004 [212.227.17.190]) with ESMTPSA (Nemesis) id 1MWzk3-1s1kkc1vuD-00WDZu; Sun, 19 May 2024 09:58:59 +0200 Content-Language: en-US In-Reply-To: <86jzjre9xh.fsf@gnu.org> X-Provags-ID: V03:K1:C3qZamv6yO/CotUrnWuVNyEptxsCTBd9a/D7U6KV6Cd0at2+UdI Lx0RrBa4u0iPvNmGcn7l8FPHB/8Rq/AA8fFhhKocYBnMEMMkMB8Opnj/ogVA0X8QADZfmH+ OXar8j6Nf6Ce4Yql+HZgJcTGzn1pP8yQVamoxuHW0Sy2OCIQ8gagngATppdKqSsshMTJT39 uVkjM5d1Sq9av5ibNvPHQ== UI-OutboundReport: notjunk:1;M01:P0:qCV8S1vXko0=;LsDDGbB7OyN32FsoXlzyXs/p1nm B0PrsMBMeTL2k9PwmbAeVHv181MtootYVqQ7RTSEWYF67UVIKs+fjKUtrA1XdNnhcMqDnNZlK XQy93LtQbSO+pJKYtNg6F9cEZwUUPjiPGbrXljrDdUUvK/a/mJ5J5vQrYuXT78VeRvh0grwG/ +INtgoqV4r/SMKw7Ja4wbVlTOF35+TWM3n4cm6Dc+R7/LHxLVKGfygz/2zWuKU3LqpmsdO6Gn NDr0N+X3aPsO4Lc2e/kjKVhOpJbU/PAGt+Gi+O8ZlitDldo0rKhH0ZKc/AWr+QmwI+Svy6BKs 9N3I5N0gu14Sld4hNrKKbgrHCsn/lx0weSsLSMT4cOH0SWzYHxGJUUffuT/vO/wFUDwnuvdyR 99UfJqIhjZCHCEZHpxSPv2g4DIpTsaEp3UqQssucLyxfxY4J3XJd90yHggWXmDR8VzyxIykq7 jlE5yEYKzp4/jymTUVMmcz3nVfij4LAUgJbo8t1U//Www1pil2DI+Zt/zuiuAM8O4LI/NCLZk SPUtpJFEC/RRd/GlYPdREJ2ipBS3JhRkimn0nRlVAySHqd1LxIUdT7Jr9pWvT5T2Jqqqr4NJs EXb35TgNq5ekxA3g0EGlNu5pZdms9zZbVGhNpyIeletl9VxN7tCRjetaqmF4tWG6FBgzzyqY+ /CGBFEpbfEU627g0RbMkAzHvMMMd1eNWGLwC9ui2G3rDJ2u4TSGAx8cGdEaWK0eLuXG7gKVXn 7cT9uCictbm3ug/DPt05x4ZHIyJpa3bdew5LjLqhWAClWX7BbfNmlwCiIzUZLHifgR/kJTLO 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:285411 Archived-At: > 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. 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. martin