[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#45628: 28.0.50; Scrolling on echo area with pixel-scroll-mode enable
From: |
Tak Kunihiro |
Subject: |
bug#45628: 28.0.50; Scrolling on echo area with pixel-scroll-mode enabled locks up Emacs |
Date: |
Wed, 6 Jan 2021 09:47:26 +0900 |
> How about a normal while loop with catch before it and throw inside?
>
> + (while (and (pixel-point-at-top-p amt) ; prevent too late (multi
> tries)
> + (equal (vertical-motion 1) 1))) ; move point downward
>
> + (while (and (pixel-point-at-bottom-p amt) ; prevent too late (multi
> tries)
> + (equal (vertical-motion -1) -1))) ; move point upward
>
> I think equality to 1 or -1 is too stringent. vertical-motion could
> move more if you have overlay strings or display strings at point that
> include embedded newlines. So I think you should test >= 1 and <= -1
> respectively.
I revised the patch and is attached on this message.
> Also, I believe this problem exists on the emacs-27 branch as well,
> right? Then we should install there first.
Yes. Can you install the patch with the commit message to emacs-27 branch?
TIA
commit message
Avoid infloop on scrolling a window with one screen line height.
* lisp/pixel-scroll.el (pixel-scroll-up, pixel-scroll-down): Escape
while loop when point did not move by `vertical-motion'. (Bug#45628)
diff --git a/lisp/pixel-scroll.el b/lisp/pixel-scroll.el
index cc0e159fae..68dc0fb94b 100644
--- a/lisp/pixel-scroll.el
+++ b/lisp/pixel-scroll.el
@@ -132,8 +132,10 @@ pixel-scroll-up
(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 @@ pixel-scroll-down
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