Skip to content

Commit 5792cd7

Browse files
committed
Temporarily widen in good-scroll--point-at-top-p
Fixes #16
1 parent 60fd0a7 commit 5792cd7

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

good-scroll.el

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,8 +165,11 @@ and shouldn't be run normally."
165165

166166
(defun good-scroll--point-at-top-p ()
167167
"Return non-nil if the point is close to the top of the selected window."
168-
(<= (line-number-at-pos (point) t)
169-
(1+ (line-number-at-pos (window-start) t))))
168+
(save-restriction
169+
;; Widen in case the window start is outside the visible part of the buffer
170+
(widen)
171+
(<= (line-number-at-pos (point) t)
172+
(1+ (line-number-at-pos (window-start) t)))))
170173

171174
(defun good-scroll--advice-line-move (line-move &rest args)
172175
"Call LINE-MOVE with ARGS, but avoid resetting the vscroll.

0 commit comments

Comments
 (0)