* lisp/window.el (fit-window-to-buffer): Fix width calculation
authorMorgan Smith <Morgan.J.Smith@outlook.com>
Sun, 12 May 2024 13:19:30 +0000 (09:19 -0400)
committerEli Zaretskii <eliz@gnu.org>
Sun, 19 May 2024 08:07:09 +0000 (11:07 +0300)
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)

lisp/window.el

index 8feeba0d83e8b089e83e8b436d03eb726b54b922..e709e978cc91deab31bdcb5db0a1499945a187c5 100644 (file)
@@ -9906,8 +9906,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)))