bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#69972: 29.1; Unexpected behavior when scrolling images


From: Joseph Turner
Subject: bug#69972: 29.1; Unexpected behavior when scrolling images
Date: Sun, 24 Mar 2024 18:06:44 -0700

Eli Zaretskii <eliz@gnu.org> writes:

>> Date: Sun, 24 Mar 2024 02:07:16 -0700
>> From:  Joseph Turner via "Bug reports for GNU Emacs,
>>  the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
>>
>> When the image at point is larger than the current window and there is
>> no content after the image, interactively scrolling down (with the
>> scroll-up command) unexpectedly scrolls past the image to blankness.
>
> I cannot reproduce this, I think.
>
>> Test this by evaluating the following snippet then interactively running
>> `scroll-up' repeatedly:
>>
>> (with-current-buffer (get-buffer-create "*test-scroll-image*")
>>   (erase-buffer)
>>   (insert-image (create-image "splash.png" nil nil
>>     ;; Scale the image more if it doesn't take up the whole window.
>>     :scale 5))
>>   (goto-char (point-max))
>>   (pop-to-buffer (current-buffer)))
>
> This recipe doesn't include the call to scroll-up, so I'm unsure how
> you did that and what you saw.  When I try "M-: (scroll-up) RET" or
> "M-x scroll-up RET", I get several scrolls by window-size, and then
> "End of buffer" error when I hit the end of the buffer.  If this is
> unexpected, please tell why.

On my machine, I don't get "End of buffer" error.  I tested three
different ways in the following snippet

(with-current-buffer (get-buffer-create "*test-scroll-image*")
  (erase-buffer)
  (insert-image (create-image "splash.png" nil nil
    ;; Scale the image more if it doesn't take up the whole window.
    :scale 5))
  (goto-char (point-max))
  (pixel-scroll-precision-mode -1)  ; Ensure mouse wheel scroll up and down 
works
  (pop-to-buffer (current-buffer)))

1. "M-: (scroll-up) RET" (repeatedly)
2. C-v (repeatedly)
3. <wheel-down> (repeatedly)

With all three methods, at first Emacs gradually scrolls the image, but
then when I reach the bottom of the image, the image disappears entirely
as Emacs scrolls past it all at once.

>> Even more unexpectedly, when point is before the image, running
>> `scroll-up' repeatedly eventually scrolls back to the top of the image:
>>
>> (with-current-buffer (get-buffer-create "*test-scroll-image*")
>>   (erase-buffer)
>>   (insert-image (create-image "splash.png" nil nil :scale 5))
>>   (goto-char (point-min))
>>   (pop-to-buffer (current-buffer)))
>
> I do see this, but why is that a problem?  You supposed to use
> scroll-up-command instead, which handles these marginal cases much
> better.  scroll-up itself is not smart enough to avoid the perceived
> "scroll back to top", which is actually caused by the fact that we
> zero out window-vscroll (which is how we handle scrolling past large
> images).

You're right.  This is not a problem in practice.  When point is before
the image, both C-v and <wheel-down> produce the same behavior as above.

Joseph





reply via email to

[Prev in Thread] Current Thread [Next in Thread]