diff options
| author | Stefan Monnier | 2005-03-28 14:52:02 +0000 |
|---|---|---|
| committer | Stefan Monnier | 2005-03-28 14:52:02 +0000 |
| commit | ba96f392009080f6262c8287635868e11ae56747 (patch) | |
| tree | 34b99466407480a2d06026a97b1649c7f844a211 | |
| parent | 12566797d3f622212d165bb1d11df335e295dc4a (diff) | |
| download | emacs-ba96f392009080f6262c8287635868e11ae56747.tar.gz emacs-ba96f392009080f6262c8287635868e11ae56747.zip | |
(window-buffer-height): Use count-screen-lines.
| -rw-r--r-- | lisp/ChangeLog | 2 | ||||
| -rw-r--r-- | lisp/window.el | 21 |
2 files changed, 9 insertions, 14 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 46f5bdc0880..5fe346e9840 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,5 +1,7 @@ | |||
| 1 | 2005-03-28 Stefan Monnier <monnier@iro.umontreal.ca> | 1 | 2005-03-28 Stefan Monnier <monnier@iro.umontreal.ca> |
| 2 | 2 | ||
| 3 | * window.el (window-buffer-height): Use count-screen-lines. | ||
| 4 | |||
| 3 | * progmodes/python.el (python-preoutput-leftover): New var. | 5 | * progmodes/python.el (python-preoutput-leftover): New var. |
| 4 | (python-preoutput-filter): Use it. | 6 | (python-preoutput-filter): Use it. |
| 5 | (python-send-receive): Loop until all the result has been received. | 7 | (python-send-receive): Loop until all the result has been received. |
diff --git a/lisp/window.el b/lisp/window.el index 5768436eaae..b4fd664a43c 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." | |||
| 397 | 397 | ||
| 398 | (defun window-buffer-height (window) | 398 | (defun window-buffer-height (window) |
| 399 | "Return the height (in screen lines) of the buffer that WINDOW is displaying." | 399 | "Return the height (in screen lines) of the buffer that WINDOW is displaying." |
| 400 | (save-excursion | 400 | (with-current-buffer (window-buffer window) |
| 401 | (set-buffer (window-buffer window)) | 401 | (max 1 |
| 402 | (goto-char (point-min)) | 402 | (count-screen-lines (point-min) (point-max) |
| 403 | (let ((ignore-final-newline | 403 | ;; If buffer ends with a newline, ignore it when |
| 404 | ;; If buffer ends with a newline, ignore it when counting height | 404 | ;; counting height unless point is after it. |
| 405 | ;; unless point is after it. | 405 | (eobp) |
| 406 | (and (not (eobp)) (eq ?\n (char-after (1- (point-max))))))) | 406 | window)))) |
| 407 | (+ 1 (nth 2 (compute-motion (point-min) | ||
| 408 | '(0 . 0) | ||
| 409 | (- (point-max) (if ignore-final-newline 1 0)) | ||
| 410 | (cons 0 100000000) | ||
| 411 | nil | ||
| 412 | nil | ||
| 413 | window)))))) | ||
| 414 | 407 | ||
| 415 | (defun count-screen-lines (&optional beg end count-final-newline window) | 408 | (defun count-screen-lines (&optional beg end count-final-newline window) |
| 416 | "Return the number of screen lines in the region. | 409 | "Return the number of screen lines in the region. |