]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix `fit-window-to-buffer' (Bug#18498).
authorKan-Ru Chen <kanru@kanru.info>
Thu, 18 Sep 2014 12:06:17 +0000 (14:06 +0200)
committerMartin Rudalics <rudalics@gmx.at>
Thu, 18 Sep 2014 12:06:17 +0000 (14:06 +0200)
* window.el (fit-window-to-buffer): When counting buffer width,
count the whole visible buffer.  Correctly convert the body-height
to pixel size for window-text-pixel-size (Bug#18498).

lisp/ChangeLog
lisp/window.el

index b696eb61ab9a878c969bf54015b8d02eac24b0f2..0a72fa4aa2bf3c1b5d4b8c6a9a48c44fcd18c4df 100644 (file)
@@ -1,3 +1,9 @@
+2014-09-18  Kan-Ru Chen  <kanru@kanru.info>
+
+       * window.el (fit-window-to-buffer): When counting buffer width,
+       count the whole visible buffer.  Correctly convert the body-height
+       to pixel size for window-text-pixel-size (Bug#18498).
+
 2014-09-14  Glenn Morris  <rgm@gnu.org>
 
        * image.el (image-multi-frame-p): Fix thinko - do not force
index 4dc30ff968cdb116d9a6160d376779c71115b538..7692c797afe5da74337a925fcc476d7cb4380b57 100644 (file)
@@ -7289,10 +7289,10 @@ accessible position."
                             max-width))
                    (+ total-width (window-max-delta
                                    nil t nil nil nil nil pixelwise))))
-                ;; When fitting vertically, assume that WINDOW's start
-                ;; position remains unaltered.  WINDOW can't get wider
-                ;; than its frame's pixel width, its height remains
-                ;; unaltered.
+                ;; When fitting horizontally, assume that WINDOW's
+                ;; start position remains unaltered.  WINDOW can't get
+                ;; wider than its frame's pixel width, its height
+                ;; remains unaltered.
                 (width (+ (car (window-text-pixel-size
                                 nil (window-start) (point-max)
                                 (frame-pixel-width)
@@ -7301,7 +7301,7 @@ accessible position."
                                 ;; overshoots when the first line below
                                 ;; the bottom is wider than the window.
                                 (* body-height
-                                   (if pixelwise char-height 1))))
+                                   (if pixelwise 1 char-height))))
                           (window-right-divider-width))))
            (unless pixelwise
              (setq width (/ (+ width char-width -1) char-width)))