summaryrefslogtreecommitdiff
path: root/lisp/pixel-scroll.el
diff options
context:
space:
mode:
authorPo Lu <luangruo@yahoo.com>2021-12-08 18:36:18 +0800
committerPo Lu <luangruo@yahoo.com>2021-12-08 18:36:18 +0800
commitf10d4b31d6d9cc370597a32da4a88ac2d63e7bab (patch)
tree60f36c1987c98d8a372e55cf85cb02b7103f4886 /lisp/pixel-scroll.el
parentd8c383b25edce88a0812edafc349e360d8d03dc9 (diff)
downloademacs-f10d4b31d6d9cc370597a32da4a88ac2d63e7bab.tar.gz
Clear scroll interpolation when interpolated scroll completes
* lisp/pixel-scroll.el (pixel-scroll-precision-interpolate): Set saved interpolation to nil upon completion.
Diffstat (limited to 'lisp/pixel-scroll.el')
-rw-r--r--lisp/pixel-scroll.el20
1 files changed, 14 insertions, 6 deletions
diff --git a/lisp/pixel-scroll.el b/lisp/pixel-scroll.el
index b322bf9a53d..94c14d50dca 100644
--- a/lisp/pixel-scroll.el
+++ b/lisp/pixel-scroll.el
@@ -550,7 +550,8 @@ animation."
(rem (window-parameter nil 'interpolated-scroll-remainder))
(time (window-parameter nil 'interpolated-scroll-remainder-time)))
(when (and rem time
- (< (- (float-time) time) 1.0))
+ (< (- (float-time) time) 1.0)
+ (eq (< delta 0) (< rem 0)))
(setq delta (+ delta rem)))
(while-no-input
(unwind-protect
@@ -568,11 +569,18 @@ animation."
(ceiling (* (* delta factor)
(/ between-scroll total-time)))))
(setq last-time (float-time)))
- (when (< percentage 1)
- (set-window-parameter nil 'interpolated-scroll-remainder
- (* delta (- 1 percentage)))
- (set-window-parameter nil 'interpolated-scroll-remainder-time
- (float-time)))))))
+ (if (< percentage 1)
+ (progn
+ (set-window-parameter nil 'interpolated-scroll-remainder
+ (* delta (- 1 percentage)))
+ (set-window-parameter nil 'interpolated-scroll-remainder-time
+ (float-time)))
+ (set-window-parameter nil
+ 'interpolated-scroll-remainder
+ nil)
+ (set-window-parameter nil
+ 'interpolated-scroll-remainder-time
+ nil))))))
(defun pixel-scroll-precision-scroll-up (delta)
"Scroll the current window up by DELTA pixels."