aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Monnier <[email protected]>2005-03-28 14:52:02 +0000
committerStefan Monnier <[email protected]>2005-03-28 14:52:02 +0000
commitba96f392009080f6262c8287635868e11ae56747 (patch)
tree34b99466407480a2d06026a97b1649c7f844a211
parent12566797d3f622212d165bb1d11df335e295dc4a (diff)
(window-buffer-height): Use count-screen-lines.
-rw-r--r--lisp/ChangeLog2
-rw-r--r--lisp/window.el21
2 files changed, 9 insertions, 14 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 46f5bdc088..5fe346e984 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,5 +1,7 @@
2005-03-28 Stefan Monnier <[email protected]>
+ * window.el (window-buffer-height): Use count-screen-lines.
+
* progmodes/python.el (python-preoutput-leftover): New var.
(python-preoutput-filter): Use it.
(python-send-receive): Loop until all the result has been received.
diff --git a/lisp/window.el b/lisp/window.el
index 5768436eaa..b4fd664a43 100644
--- a/lisp/window.el
+++ b/lisp/window.el
@@ -397,20 +397,13 @@ lines than are actually needed in the case where some error may be present."
(defun window-buffer-height (window)
"Return the height (in screen lines) of the buffer that WINDOW is displaying."
- (save-excursion
- (set-buffer (window-buffer window))
- (goto-char (point-min))
- (let ((ignore-final-newline
- ;; If buffer ends with a newline, ignore it when counting height
- ;; unless point is after it.
- (and (not (eobp)) (eq ?\n (char-after (1- (point-max)))))))
- (+ 1 (nth 2 (compute-motion (point-min)
- '(0 . 0)
- (- (point-max) (if ignore-final-newline 1 0))
- (cons 0 100000000)
- nil
- nil
- window))))))
+ (with-current-buffer (window-buffer window)
+ (max 1
+ (count-screen-lines (point-min) (point-max)
+ ;; If buffer ends with a newline, ignore it when
+ ;; counting height unless point is after it.
+ (eobp)
+ window))))
(defun count-screen-lines (&optional beg end count-final-newline window)
"Return the number of screen lines in the region.