summaryrefslogtreecommitdiff
path: root/lisp/pixel-scroll.el
diff options
context:
space:
mode:
authorGlenn Morris <rgm@gnu.org>2021-01-14 07:50:28 -0800
committerGlenn Morris <rgm@gnu.org>2021-01-14 07:50:28 -0800
commitc83590b12114a0958c8e26846c87c84f492405bc (patch)
tree3352fc89c72c6b68501f4d66d2828a8377320d8e /lisp/pixel-scroll.el
parent4ad332d844b5b441c05c617304853e80a4714d51 (diff)
parent488204cdc64b6a130042ecc64d59c4538287b81d (diff)
downloademacs-c83590b12114a0958c8e26846c87c84f492405bc.tar.gz
Merge from origin/emacs-27
488204cdc6 (origin/emacs-27) Remove one of recently added warnings ab... 55bc1560ac Fix assertion failure in window_box_height (Bug#45737) 27743e9e70 Fix cl-concatenate inlining 32a3758c84 Fix infloop in 'pixel-scroll-mode' 74d18957b8 Fix inhibiting the default.el loading in user init file
Diffstat (limited to 'lisp/pixel-scroll.el')
-rw-r--r--lisp/pixel-scroll.el12
1 files changed, 8 insertions, 4 deletions
diff --git a/lisp/pixel-scroll.el b/lisp/pixel-scroll.el
index cc0e159faef..68dc0fb94b3 100644
--- a/lisp/pixel-scroll.el
+++ b/lisp/pixel-scroll.el
@@ -132,8 +132,10 @@ This is an alternative of `scroll-up'. Scope moves downward."
(pixel-line-height))))
(if (pixel-eob-at-top-p) ; when end-of-the-buffer is close
(scroll-up 1) ; relay on robust method
- (while (pixel-point-at-top-p amt) ; prevent too late (multi tries)
- (vertical-motion 1)) ; move point downward
+ (catch 'no-movement
+ (while (pixel-point-at-top-p amt) ; prevent too late (multi tries)
+ (unless (>= (vertical-motion 1) 1) ; move point downward
+ (throw 'no-movement nil)))) ; exit loop when point did not move
(pixel-scroll-pixel-up amt)))))) ; move scope downward
(defun pixel-scroll-down (&optional arg)
@@ -149,8 +151,10 @@ This is and alternative of `scroll-down'. Scope moves upward."
pixel-resolution-fine-flag
(frame-char-height))
(pixel-line-height -1))))
- (while (pixel-point-at-bottom-p amt) ; prevent too late (multi tries)
- (vertical-motion -1)) ; move point upward
+ (catch 'no-movement
+ (while (pixel-point-at-bottom-p amt) ; prevent too late (multi tries)
+ (unless (<= (vertical-motion -1) -1) ; move point upward
+ (throw 'no-movement nil)))) ; exit loop when point did not move
(if (or (pixel-bob-at-top-p amt) ; when beginning-of-the-buffer is seen
(pixel-eob-at-top-p)) ; for file with a long line
(scroll-down 1) ; relay on robust method