From: Morgan Smith Date: Sun, 12 May 2024 13:19:30 +0000 (-0400) Subject: * lisp/window.el (fit-window-to-buffer): Fix width calculation X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=44dcfe8077185c48a603648b830c4b661af9ae84;p=emacs.git * lisp/window.el (fit-window-to-buffer): Fix width calculation When PIXELWISE is nil, we still calculate width in pixels and then convert it to columns. However, part of the calculation was using columns where it should have used pixels. (Bug#70894) (cherry picked from commit 42d444114d8df0ffddf1e80891a386c0edcbd976) --- diff --git a/lisp/window.el b/lisp/window.el index 4adad916f47..0da64bb5d7f 100644 --- a/lisp/window.el +++ b/lisp/window.el @@ -9922,8 +9922,8 @@ accessible position." ;; the bottom is wider than the window. (* (window-body-height window pixelwise) (if pixelwise 1 char-height)))) - (- total-width - (window-body-width window pixelwise))))) + (- (* total-width (if pixelwise 1 char-width)) + (window-body-width window t))))) (unless pixelwise (setq width (/ (+ width char-width -1) char-width))) (setq width (max min-width (min max-width width)))