all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Tak Kunihiro <tkk@misasa.okayama-u.ac.jp>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 45628@debbugs.gnu.org, 国広卓也 <tkk@misasa.okayama-u.ac.jp>,
	"Amin Bandali" <bandali@gnu.org>
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	[thread overview]
Message-ID: <ACA5C133-C341-46D9-9552-5799C3E98E1A@misasa.okayama-u.ac.jp> (raw)
In-Reply-To: <83turwbulo.fsf@gnu.org>

> 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







  reply	other threads:[~2021-01-06  0:47 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-03 16:14 bug#45628: 28.0.50; Scrolling on echo area with pixel-scroll-mode enabled locks up Emacs Amin Bandali
2021-01-03 17:30 ` Eli Zaretskii
2021-01-04  8:57   ` Tak Kunihiro
2021-01-04 15:16     ` Eli Zaretskii
2021-01-06  0:47       ` Tak Kunihiro [this message]
2021-01-09  9:22         ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ACA5C133-C341-46D9-9552-5799C3E98E1A@misasa.okayama-u.ac.jp \
    --to=tkk@misasa.okayama-u.ac.jp \
    --cc=45628@debbugs.gnu.org \
    --cc=bandali@gnu.org \
    --cc=eliz@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.