]> git.eshelyaron.com Git - emacs.git/commitdiff
(fit-window-to-buffer): Handle non-nil `truncate-lines'.
authorMiles Bader <miles@gnu.org>
Fri, 1 Dec 2000 08:11:55 +0000 (08:11 +0000)
committerMiles Bader <miles@gnu.org>
Fri, 1 Dec 2000 08:11:55 +0000 (08:11 +0000)
lisp/ChangeLog
lisp/window.el

index 67bd785e5fba745247cc2fb21210d1622fdb80eb..139361e0b52b6d8dc115bb1260efc0f38c1a8b16 100644 (file)
@@ -1,3 +1,7 @@
+2000-12-01  Miles Bader  <miles@gnu.org>
+
+       * window.el (fit-window-to-buffer): Handle non-nil `truncate-lines'.
+
 2000-12-01  Kenichi Handa  <handa@etl.go.jp>
 
        * international/mule-diag.el (describe-char-after): Fix typo.
index 86cb45f92e58d9dd71eb266a5d63db0f6f69faa2..60ebba7f1f052e898031582ec23e2e472742fca8 100644 (file)
@@ -508,9 +508,17 @@ header-line."
       (let ((end (with-current-buffer buf
                   (save-excursion
                     (goto-char (point-max))
-                    (if (and (bolp) (not (bobp)))
-                        (1- (point))
-                      (point))))))
+                    (when (and (bolp) (not (bobp)))
+                      ;; Don't include final newline
+                      (backward-char 1))
+                    (when truncate-lines
+                      ;; If line-wrapping is turned off, test the
+                      ;; beginning of the last line for visibility
+                      ;; instead of the end, as the end of the line
+                      ;; could be invisible by virtue of extending past
+                      ;; the edge of the window.
+                      (forward-line 0))
+                    (point)))))
        (set-window-vscroll window 0)
        (while (and (< desired-height max-height)
                    (= desired-height (window-height window))