emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master bf79dad: Make interpolated scrolling work better


From: Po Lu
Subject: master bf79dad: Make interpolated scrolling work better
Date: Wed, 8 Dec 2021 00:40:44 -0500 (EST)

branch: master
commit bf79dad3f20345ddf095325ce22c0f2a3408d3ba
Author: Po Lu <luangruo@yahoo.com>
Commit: Po Lu <luangruo@yahoo.com>

    Make interpolated scrolling work better
    
    * lisp/pixel-scroll.el (pixel-scroll-precision-interpolate):
    Stop using `while-no-input'.
---
 lisp/pixel-scroll.el | 35 +++++++++++++++++------------------
 1 file changed, 17 insertions(+), 18 deletions(-)

diff --git a/lisp/pixel-scroll.el b/lisp/pixel-scroll.el
index 10736de..6191c05 100644
--- a/lisp/pixel-scroll.el
+++ b/lisp/pixel-scroll.el
@@ -541,24 +541,23 @@ the height of the current window."
   "Interpolate a scroll of DELTA pixels.
 This results in the window being scrolled by DELTA pixels with an
 animation."
-  (while-no-input
-    (let ((percentage 0)
-          (total-time pixel-scroll-precision-interpolation-total-time)
-          (factor pixel-scroll-precision-interpolation-factor)
-          (time-elapsed 0.0)
-          (between-scroll 0.001))
-      (while (< percentage 1)
-        (sit-for between-scroll)
-        (setq time-elapsed (+ time-elapsed between-scroll)
-              percentage (/ time-elapsed total-time))
-        (if (< delta 0)
-            (pixel-scroll-precision-scroll-down
-             (ceiling (abs (* (* delta factor)
-                              (/ between-scroll total-time)))))
-          (pixel-scroll-precision-scroll-up
-           (ceiling (* (* delta factor)
-                       (/ between-scroll total-time)))))
-        (redisplay t)))))
+  (let ((percentage 0)
+        (total-time pixel-scroll-precision-interpolation-total-time)
+        (factor pixel-scroll-precision-interpolation-factor)
+        (time-elapsed 0.0)
+        (between-scroll 0.001))
+    (while (< percentage 1)
+      (sit-for between-scroll)
+      (setq time-elapsed (+ time-elapsed between-scroll)
+            percentage (/ time-elapsed total-time))
+      (if (< delta 0)
+          (pixel-scroll-precision-scroll-down
+           (ceiling (abs (* (* delta factor)
+                            (/ between-scroll total-time)))))
+        (pixel-scroll-precision-scroll-up
+         (ceiling (* (* delta factor)
+                     (/ between-scroll total-time)))))
+      (redisplay t))))
 
 (defun pixel-scroll-precision-scroll-up (delta)
   "Scroll the current window up by DELTA pixels."



reply via email to

[Prev in Thread] Current Thread [Next in Thread]