diff options
author | Miles Bader <miles@gnu.org> | 2000-12-11 05:02:17 +0000 |
---|---|---|
committer | Miles Bader <miles@gnu.org> | 2000-12-11 05:02:17 +0000 |
commit | db7ebd73606a431ba968376a06cd6ebbfd39ccd0 (patch) | |
tree | 6098bae659b43598ea634471307d7416fd930e02 /lisp/gnus | |
parent | 802cf66c54be8f762c4b65a0a4d91010fdc7cd1e (diff) | |
download | emacs-db7ebd73606a431ba968376a06cd6ebbfd39ccd0.tar.gz |
(gnus-summary-recenter): When trying to keep the bottom line visible,
check to see if it's partially obscured, and if so, either scroll one
more line to make it fully visible, or revert to showing the second line
from the top.
Diffstat (limited to 'lisp/gnus')
-rw-r--r-- | lisp/gnus/ChangeLog | 7 | ||||
-rw-r--r-- | lisp/gnus/gnus-sum.el | 20 |
2 files changed, 23 insertions, 4 deletions
diff --git a/lisp/gnus/ChangeLog b/lisp/gnus/ChangeLog index a40458adc26..f7be69dd774 100644 --- a/lisp/gnus/ChangeLog +++ b/lisp/gnus/ChangeLog @@ -1,3 +1,10 @@ +2000-12-11 Miles Bader <miles@gnu.org> + + * gnus-sum.el (gnus-summary-recenter): When trying to keep the + bottom line visible, check to see if it's partially obscured, and + if so, either scroll one more line to make it fully visible, or + revert to showing the second line from the top. + 2000-12-07 Dave Love <fx@gnu.org> * mailcap.el (mailcap-download-directory) diff --git a/lisp/gnus/gnus-sum.el b/lisp/gnus/gnus-sum.el index cb58e81224c..33023546ccd 100644 --- a/lisp/gnus/gnus-sum.el +++ b/lisp/gnus/gnus-sum.el @@ -5273,10 +5273,22 @@ displayed, no centering will be performed." ;; Set the window start to either `bottom', which is the biggest ;; possible valid number, or the second line from the top, ;; whichever is the least. - (set-window-start - window (min bottom (save-excursion - (forward-line (- top)) (point))) - t)) + (let ((top-pos (save-excursion (forward-line (- top)) (point)))) + (if (> bottom top-pos) + ;; Keep the second line from the top visible + (set-window-start window top-pos t) + ;; Try to keep the bottom line visible; if it's partially + ;; obscured, either scroll one more line to make it fully + ;; visible, or revert to using TOP-POS. + (save-excursion + (goto-char (point-max)) + (forward-line -1) + (let ((last-line-start (point))) + (goto-char bottom) + (set-window-start window (point) t) + (when (not (pos-visible-in-window-p last-line-start window)) + (forward-line 1) + (set-window-start window (min (point) top-pos) t))))))) ;; Do horizontal recentering while we're at it. (when (and (get-buffer-window (current-buffer) t) (not (eq gnus-auto-center-summary 'vertical))) |