all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Rahguzar via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
To: Po Lu <luangruo@yahoo.com>
Cc: 65214@debbugs.gnu.org
Subject: bug#65214: 29.1; Tall images in 'image-mode' can't be scrolled with 'pixel-scroll-precision-mode' on
Date: Fri, 11 Aug 2023 15:19:53 +0200	[thread overview]
Message-ID: <875y5ld55b.fsf@zohomail.eu> (raw)
In-Reply-To: <s0dwmy2w8nf.fsf@yahoo.com>

Hi Po,
In this case it is not the recentering which is causing this problem,
it is rather the binding for next-pos in
pixel-scroll-precision-scroll-down-page which is the issue. The
binding signals an error when downward vertical motion is not
possible. However in this scenario scrolling can still be done.
Replacing that binding with desired-start allow me to scroll the
images.

This change for example allows for scrolling tall images,
@@ -524,10 +524,12 @@ pixel-scroll-precision-scroll-down-page
          (next-pos (save-excursion
                      (goto-char desired-start)
                      (when (zerop (vertical-motion (1+ scroll-margin)))
-                       (set-window-start nil desired-start)
-                       (signal 'end-of-buffer nil))
+                       (unless (let ((remaining-bottom (nth 3 (pos-visible-in-window-p desired-start nil t))))
+                                 (and remaining-bottom (not (zerop remaining-bottom))))
+                         (signal 'end-of-buffer nil)))
                      (while (when-let ((posn (posn-at-point)))
-                              (< (cdr (posn-x-y posn)) delta))
+                              (and (< (point) (point-min))
+                                   (< (cdr (posn-x-y posn)) delta)))
                        (when (zerop (vertical-motion 1))
                          (set-window-start nil desired-start)
                          (signal 'end-of-buffer nil)))

I am not sure it is the correct change since I don't understand the
while loop but comparing 'point' and 'point-min' doesn't seem the write
thing there. On the others hand if there is 'point-min' is 1 and
'point-max' 2, (cdr (posn-x-y posn))

Po Lu <luangruo@yahoo.com> writes:

> This is a known limitation of pixel-scroll-precision-mode: redisplay's
> automatic recentering impededs adjustment of the vscroll as the image
> moves outside of the window's text area.  Unfortunately, it's not slated
> to be fixed any time soon.

In this case it is not the recentering which is causing this problem,
it is rather the binding for next-pos in
pixel-scroll-precision-scroll-down-page which is the issue. The
binding signals an error when downward vertical motion is not
possible. However in this scenario scrolling can still be done.
Replacing that binding with desired-start allow me to scroll the
images.

This change for example allows for scrolling tall images,
@@ -524,10 +524,12 @@ pixel-scroll-precision-scroll-down-page
          (next-pos (save-excursion
                      (goto-char desired-start)
                      (when (zerop (vertical-motion (1+ scroll-margin)))
-                       (set-window-start nil desired-start)
-                       (signal 'end-of-buffer nil))
+                       (unless (let ((remaining-bottom (nth 3 (pos-visible-in-window-p desired-start nil t))))
+                                 (and remaining-bottom (not (zerop remaining-bottom))))
+                         (signal 'end-of-buffer nil)))
                      (while (when-let ((posn (posn-at-point)))
-                              (< (cdr (posn-x-y posn)) delta))
+                              (and (< (point) (point-min))
+                                   (< (cdr (posn-x-y posn)) delta)))
                        (when (zerop (vertical-motion 1))
                          (set-window-start nil desired-start)
                          (signal 'end-of-buffer nil)))

I am not sure it is the correct change since I don't understand the
while loop but comparing 'point' and 'point-min' doesn't seem the write
thing there. On the others hand if there is 'point-min' is 1 and
'point-max' 2, (cdr (posn-x-y posn)) is always zero, so that check makes
the loop terminate without signaling an error.

The behavior is also sub optimal in that it allows for scrolling past
the lower edge of the image but how much depends on the speed of the
scrolling, but that can be fixed easily.

Rahguzar





  reply	other threads:[~2023-08-11 13:19 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-10 17:05 bug#65214: 29.1; Tall images in 'image-mode' can't be scrolled with 'pixel-scroll-precision-mode' on Rahguzar via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-08-11  3:38 ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-08-11 13:19   ` Rahguzar via Bug reports for GNU Emacs, the Swiss army knife of text editors [this message]
2023-08-11 14:39     ` Rahguzar via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-08-12  2:22       ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-08-12  6:50         ` Rahguzar via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-08-12  7:25           ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-08-12 10:43             ` Rahguzar via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-08-27  7:53             ` Rahguzar via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-08-27  8:16               ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-08-27  8:53                 ` Rahguzar via Bug reports for GNU Emacs, the Swiss army knife of text editors

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=875y5ld55b.fsf@zohomail.eu \
    --to=bug-gnu-emacs@gnu.org \
    --cc=65214@debbugs.gnu.org \
    --cc=luangruo@yahoo.com \
    --cc=rahguzar@zohomail.eu \
    /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.