summaryrefslogtreecommitdiff
path: root/lisp/follow.el
diff options
context:
space:
mode:
authorAlan Mackenzie <acm@muc.de>2021-11-07 20:44:46 +0000
committerAlan Mackenzie <acm@muc.de>2021-11-07 20:44:46 +0000
commit0c51db6bb19c0142fc0d866a7257e21de83374f3 (patch)
tree3b5bc0dd4ce9e84802bcf2c7fc7282b4cd701a39 /lisp/follow.el
parent261367781b8f4dcbd58fff2f7a99cd8fb4581e65 (diff)
downloademacs-0c51db6bb19c0142fc0d866a7257e21de83374f3.tar.gz
Amend Follow Mode to handle header lines and tab lines correctly
This fixes bug #51590. list/follow.el (follow-scroll-down): Incorporate the height of the tab line into the calculation of the window height. (follow-calc-win-end): Incorporate the pixel heights of the header line and the tab line the calculation of the buffer position of the bottom screen line.
Diffstat (limited to 'lisp/follow.el')
-rw-r--r--lisp/follow.el20
1 files changed, 14 insertions, 6 deletions
diff --git a/lisp/follow.el b/lisp/follow.el
index b64f4cb7348..2ca2c1f17ba 100644
--- a/lisp/follow.el
+++ b/lisp/follow.el
@@ -667,7 +667,8 @@ Works like `scroll-down' when not in Follow mode."
(scroll-down-command arg))
(arg (follow-scroll-down-arg arg))
(t
- (let* ((windows (follow-all-followers))
+ (let* ((orig-point (point))
+ (windows (follow-all-followers))
(win (car (reverse windows)))
(start (window-start (car windows))))
(if (eq start (point-min))
@@ -678,11 +679,14 @@ Works like `scroll-down' when not in Follow mode."
(select-window win)
(goto-char start)
(vertical-motion (- (- (window-height win)
- (if header-line-format 2 1)
- next-screen-context-lines)))
+ (if header-line-format 2 1) ; always mode-line
+ (if tab-line-format 1 0)
+ next-screen-context-lines)))
(set-window-start win (point))
- (goto-char start)
- (vertical-motion (- next-screen-context-lines 1))
+ (if (< orig-point (window-end win t))
+ (goto-char orig-point)
+ (goto-char start)
+ (vertical-motion (- next-screen-context-lines 1)))
(setq follow-internal-force-redisplay t))))))
(put 'follow-scroll-down 'scroll-command t)
@@ -947,7 +951,11 @@ used."
(let* ((win (or win (selected-window)))
(edges (window-inside-pixel-edges win))
(ht (- (nth 3 edges) (nth 1 edges)))
- (last-line-pos (posn-point (posn-at-x-y 0 (1- ht) win))))
+ (last-line-pos (posn-point
+ (posn-at-x-y 0 (+ (window-header-line-height win)
+ (window-tab-line-height win)
+ (1- ht))
+ win))))
(if (pos-visible-in-window-p last-line-pos win)
(let ((end (window-end win t)))
(list end (pos-visible-in-window-p (point-max) win)))