]> git.eshelyaron.com Git - emacs.git/commitdiff
* lisp/pixel-scroll.el (pixel-scroll-precision): Handle zero delta.
authorPo Lu <luangruo@yahoo.com>
Tue, 30 Nov 2021 11:28:04 +0000 (19:28 +0800)
committerPo Lu <luangruo@yahoo.com>
Tue, 30 Nov 2021 11:28:04 +0000 (19:28 +0800)
lisp/pixel-scroll.el

index 1af292139ea01bdc7ff5d057e224dd1af8084f1c..2fd7cace0b0c085e29dc00cd4653256e74a455a1 100644 (file)
@@ -477,18 +477,19 @@ wheel."
     (if (and (nth 4 event)
              (zerop (window-hscroll window)))
         (let ((delta (round (cdr (nth 4 event)))))
-          (if (> (abs delta) (window-text-height window t))
-              (mwheel-scroll event nil)
-            (with-selected-window window
-              (condition-case nil
-                  (if (< delta 0)
-                     (pixel-scroll-precision-scroll-down (- delta))
-                    (pixel-scroll-precision-scroll-up delta))
-                ;; Do not ding at buffer limits.  Show a message instead.
-                (beginning-of-buffer
-                 (message (error-message-string '(beginning-of-buffer))))
-                (end-of-buffer
-                 (message (error-message-string '(end-of-buffer))))))))
+          (unless (zerop delta)
+            (if (> (abs delta) (window-text-height window t))
+                (mwheel-scroll event nil)
+              (with-selected-window window
+                (condition-case nil
+                    (if (< delta 0)
+                       (pixel-scroll-precision-scroll-down (- delta))
+                      (pixel-scroll-precision-scroll-up delta))
+                  ;; Do not ding at buffer limits.  Show a message instead.
+                  (beginning-of-buffer
+                   (message (error-message-string '(beginning-of-buffer))))
+                  (end-of-buffer
+                   (message (error-message-string '(end-of-buffer)))))))))
       (mwheel-scroll event nil))))
 
 ;;;###autoload