Skip to content

Commit

Permalink
Fix scrolling unfocused windows (#21)
Browse files Browse the repository at this point in the history
This scrolls the window that received the scroll event,
instead of always trying to scroll the selected window.
  • Loading branch information
io12 committed Aug 16, 2021
1 parent fac87dd commit 5e6efc3
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions good-scroll.el
Original file line number Diff line number Diff line change
Expand Up @@ -270,9 +270,14 @@ this leads to `good-scroll--cached-point-top' being invalidated."
Update the window's vscroll and position in the buffer based on the scroll
progress. This is called by the timer `good-scroll--timer' every
`good-scroll-render-rate' seconds."
(let ((inhibit-redisplay t)) ; TODO: Does this do anything?
(when (eq (selected-window) good-scroll--window)
(unless (zerop good-scroll-destination)
;; Check if the window that recieved the scroll event still exists and
;; if there is distance to scroll.
(when (and (window-valid-p good-scroll--window)
(not (zerop good-scroll-destination)))
(let ((inhibit-redisplay t)) ; TODO: Does this do anything?
;; Switch to the window that recieved the scroll event,
;; which might be different from the previously selected window.
(with-selected-window good-scroll--window
(let ((position-next-try
(funcall good-scroll-algorithm))
(position-next-actual))
Expand Down

0 comments on commit 5e6efc3

Please sign in to comment.