Skip to content

Commit

Permalink
Fix jitter when scroll up with last line at top
Browse files Browse the repository at this point in the history
  • Loading branch information
io12 committed May 29, 2021
1 parent 7801bf0 commit 17d89cf
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions good-scroll.el
Original file line number Diff line number Diff line change
Expand Up @@ -314,9 +314,13 @@ below the tab and header lines."
(defun good-scroll--move-point-down ()
"Move the cursor down and update `good-scroll--cached-point-top' accordingly."
(let ((height (line-pixel-height)))
(when (= 1 (vertical-motion 1))
(setq good-scroll--cached-point-top
(+ good-scroll--cached-point-top height)))))
(if (= 1 (vertical-motion 1))
(setq good-scroll--cached-point-top
(+ good-scroll--cached-point-top height))
;; If point is on the last line,
;; `vertical-motion' moves it to the end of the line.
;; This causes a jitter, so avoid it.
(beginning-of-line))))

(defun good-scroll--move-point-out-of-way (delta)
"Move the cursor to prepare for a scroll of DELTA pixel lines.
Expand Down

0 comments on commit 17d89cf

Please sign in to comment.