[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
emacs-28 d4536ff: Fix follow-scroll-down in a small buffer which starts
From: |
Alan Mackenzie |
Subject: |
emacs-28 d4536ff: Fix follow-scroll-down in a small buffer which starts slightly scrolled |
Date: |
Sat, 13 Nov 2021 13:35:17 -0500 (EST) |
branch: emacs-28
commit d4536ff2572931b105198a85a452a777d6d3a1ff
Author: Alan Mackenzie <acm@muc.de>
Commit: Alan Mackenzie <acm@muc.de>
Fix follow-scroll-down in a small buffer which starts slightly scrolled
This fixes bug #51814.
* lisp/follow.el (follow-scroll-down): Do away with the optimization of
doing
vertical-motion over only one window. Instead move over all windows, to
checck for being close to point-min, and setting point accordingly.
---
lisp/follow.el | 32 +++++++++++++++++++-------------
1 file changed, 19 insertions(+), 13 deletions(-)
diff --git a/lisp/follow.el b/lisp/follow.el
index 2ca2c1f..3761275 100644
--- a/lisp/follow.el
+++ b/lisp/follow.el
@@ -669,24 +669,30 @@ Works like `scroll-down' when not in Follow mode."
(t
(let* ((orig-point (point))
(windows (follow-all-followers))
- (win (car (reverse windows)))
- (start (window-start (car windows))))
+ (start (window-start (car windows)))
+ (lines 0))
(if (eq start (point-min))
(if (or (null scroll-error-top-bottom)
(bobp))
(signal 'beginning-of-buffer nil)
(goto-char (point-min)))
- (select-window win)
- (goto-char start)
- (vertical-motion (- (- (window-height win)
- (if header-line-format 2 1) ; always
mode-line
- (if tab-line-format 1 0)
- next-screen-context-lines)))
- (set-window-start win (point))
- (if (< orig-point (window-end win t))
- (goto-char orig-point)
- (goto-char start)
- (vertical-motion (- next-screen-context-lines 1)))
+ (select-window (car windows))
+ (dolist (win windows)
+ (setq lines
+ (+ lines
+ (- (window-height win)
+ (if header-line-format 2 1) ; Count mode-line, too.
+ (if tab-line-format 1 0)))))
+ (setq lines (- lines next-screen-context-lines))
+ (goto-char start)
+ (let ((at-top (> (vertical-motion (- lines)) (- lines))))
+ (set-window-start (car windows) (point))
+ (if at-top
+ (goto-char orig-point)
+ (goto-char start)
+ (vertical-motion (- next-screen-context-lines 1))
+ (if (< orig-point (point))
+ (goto-char orig-point))))
(setq follow-internal-force-redisplay t))))))
(put 'follow-scroll-down 'scroll-command t)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- emacs-28 d4536ff: Fix follow-scroll-down in a small buffer which starts slightly scrolled,
Alan Mackenzie <=