From: Po Lu Date: Tue, 30 Nov 2021 11:28:04 +0000 (+0800) Subject: * lisp/pixel-scroll.el (pixel-scroll-precision): Handle zero delta. X-Git-Tag: emacs-29.0.90~3637^2 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=f633116c09d0ca8be1bdd332283108b03dfcf0c8;p=emacs.git * lisp/pixel-scroll.el (pixel-scroll-precision): Handle zero delta. --- diff --git a/lisp/pixel-scroll.el b/lisp/pixel-scroll.el index 1af292139ea..2fd7cace0b0 100644 --- a/lisp/pixel-scroll.el +++ b/lisp/pixel-scroll.el @@ -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