aboutsummaryrefslogtreecommitdiffstats
path: root/lisp
diff options
context:
space:
mode:
authorMiles Bader <[email protected]>2000-12-01 08:11:55 +0000
committerMiles Bader <[email protected]>2000-12-01 08:11:55 +0000
commit45450dd56d90d4c3682af2ed3e42ddba6977d3fe (patch)
tree3b423d30fa8a74b7d945ef337dfb2526f52a82c9 /lisp
parenta584be024c78d1fedcd03ccd3b9e28f92ec87db3 (diff)
(fit-window-to-buffer): Handle non-nil `truncate-lines'.
Diffstat (limited to 'lisp')
-rw-r--r--lisp/ChangeLog4
-rw-r--r--lisp/window.el14
2 files changed, 15 insertions, 3 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 67bd785e5f..139361e0b5 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,7 @@
+2000-12-01 Miles Bader <[email protected]>
+
+ * window.el (fit-window-to-buffer): Handle non-nil `truncate-lines'.
+
2000-12-01 Kenichi Handa <[email protected]>
* international/mule-diag.el (describe-char-after): Fix typo.
diff --git a/lisp/window.el b/lisp/window.el
index 86cb45f92e..60ebba7f1f 100644
--- a/lisp/window.el
+++ b/lisp/window.el
@@ -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))