diff options
| author | Kim F. Storm | 2006-09-18 11:13:04 +0000 |
|---|---|---|
| committer | Kim F. Storm | 2006-09-18 11:13:04 +0000 |
| commit | e437f99a4c72c5459c86bb636f63ca61ad57762e (patch) | |
| tree | a4b4bec50d2da8162915ee27fbd4d4bcc2c9a758 | |
| parent | 661bdc0600a2aa5be17c71ca4da9824013319c7a (diff) | |
| download | emacs-e437f99a4c72c5459c86bb636f63ca61ad57762e.tar.gz emacs-e437f99a4c72c5459c86bb636f63ca61ad57762e.zip | |
(line-move-partial): Rework 2006-09-15 change to use
new window-line-height function. Further optimize by not calling
pos-visible-in-window-p for window-end when window-line-height
returns useful information.
| -rw-r--r-- | lisp/simple.el | 88 |
1 files changed, 45 insertions, 43 deletions
diff --git a/lisp/simple.el b/lisp/simple.el index 3e089d4e1a8..0a257863a76 100644 --- a/lisp/simple.el +++ b/lisp/simple.el | |||
| @@ -3487,49 +3487,51 @@ Outline mode sets this." | |||
| 3487 | (set-window-vscroll nil (- vs (frame-char-height)) t))) | 3487 | (set-window-vscroll nil (- vs (frame-char-height)) t))) |
| 3488 | 3488 | ||
| 3489 | ;; Move forward (down). | 3489 | ;; Move forward (down). |
| 3490 | (let ((wvis (window-line-visibility))) | 3490 | (let* ((lh (window-line-height -1)) |
| 3491 | (when (or (null wvis) | 3491 | (vpos (nth 1 lh)) |
| 3492 | (and (consp wvis) | 3492 | (ypos (nth 2 lh)) |
| 3493 | (or (>= (car wvis) (frame-char-height)) | 3493 | (rbot (nth 3 lh)) |
| 3494 | (>= (cdr wvis) (frame-char-height))))) | 3494 | ppos py vs) |
| 3495 | (let* ((wend (window-end nil t)) | 3495 | (when (or (null lh) |
| 3496 | (evis (or (pos-visible-in-window-p wend nil t) | 3496 | (>= rbot (frame-char-height)) |
| 3497 | (pos-visible-in-window-p (1- wend) nil t))) | 3497 | (<= ypos (- (frame-char-height)))) |
| 3498 | (rbot (nth 3 evis)) | 3498 | (unless lh |
| 3499 | (vpos (nth 5 evis)) | 3499 | (let* ((wend (window-end nil t)) |
| 3500 | ppos py vs) | 3500 | (evis (or (pos-visible-in-window-p wend nil t) |
| 3501 | (cond | 3501 | (pos-visible-in-window-p (1- wend) nil t)))) |
| 3502 | ;; Last window line should be visible - fail if not. | 3502 | (setq rbot (nth 3 evis) |
| 3503 | ((null evis) | 3503 | vpos (nth 5 evis)))) |
| 3504 | nil) | 3504 | (cond |
| 3505 | ;; If last line of window is fully visible, move forward. | 3505 | ;; If last line of window is fully visible, move forward. |
| 3506 | ((null rbot) | 3506 | ((or (null rbot) (= rbot 0)) |
| 3507 | nil) | 3507 | nil) |
| 3508 | ;; If cursor is not in the bottom scroll margin, move forward. | 3508 | ;; If cursor is not in the bottom scroll margin, move forward. |
| 3509 | ((< (setq ppos (posn-at-point) | 3509 | ((and (> vpos 0) |
| 3510 | py (cdr (or (posn-actual-col-row ppos) | 3510 | (< (setq ppos (posn-at-point) |
| 3511 | (posn-col-row ppos)))) | 3511 | py (cdr (or (posn-actual-col-row ppos) |
| 3512 | (min (- (window-text-height) scroll-margin 1) (1- vpos))) | 3512 | (posn-col-row ppos)))) |
| 3513 | nil) | 3513 | (min (- (window-text-height) scroll-margin 1) (1- vpos)))) |
| 3514 | ;; When already vscrolled, we vscroll some more if we can, | 3514 | nil) |
| 3515 | ;; or clear vscroll and move forward at end of tall image. | 3515 | ;; When already vscrolled, we vscroll some more if we can, |
| 3516 | ((> (setq vs (window-vscroll nil t)) 0) | 3516 | ;; or clear vscroll and move forward at end of tall image. |
| 3517 | (when (> rbot 0) | 3517 | ((> (setq vs (window-vscroll nil t)) 0) |
| 3518 | (set-window-vscroll nil (+ vs (min rbot (frame-char-height))) t))) | 3518 | (when (> rbot 0) |
| 3519 | ;; If cursor just entered the bottom scroll margin, move forward, | 3519 | (set-window-vscroll nil (+ vs (min rbot (frame-char-height))) t))) |
| 3520 | ;; but also vscroll one line so redisplay wont recenter. | 3520 | ;; If cursor just entered the bottom scroll margin, move forward, |
| 3521 | ((= py (min (- (window-text-height) scroll-margin 1) | 3521 | ;; but also vscroll one line so redisplay wont recenter. |
| 3522 | (1- vpos))) | 3522 | ((and (> vpos 0) |
| 3523 | (set-window-vscroll nil (frame-char-height) t) | 3523 | (= py (min (- (window-text-height) scroll-margin 1) |
| 3524 | (line-move-1 arg noerror to-end) | 3524 | (1- vpos)))) |
| 3525 | t) | 3525 | (set-window-vscroll nil (frame-char-height) t) |
| 3526 | ;; If there are lines above the last line, scroll-up one line. | 3526 | (line-move-1 arg noerror to-end) |
| 3527 | ((> vpos 0) | 3527 | t) |
| 3528 | (scroll-up 1) | 3528 | ;; If there are lines above the last line, scroll-up one line. |
| 3529 | t) | 3529 | ((> vpos 0) |
| 3530 | ;; Finally, start vscroll. | 3530 | (scroll-up 1) |
| 3531 | (t | 3531 | t) |
| 3532 | (set-window-vscroll nil (frame-char-height) t)))))))) | 3532 | ;; Finally, start vscroll. |
| 3533 | (t | ||
| 3534 | (set-window-vscroll nil (frame-char-height) t))))))) | ||
| 3533 | 3535 | ||
| 3534 | 3536 | ||
| 3535 | ;; This is like line-move-1 except that it also performs | 3537 | ;; This is like line-move-1 except that it also performs |