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

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

bug#65214: 29.1; Tall images in 'image-mode' can't be scrolled with 'pix


From: Rahguzar
Subject: bug#65214: 29.1; Tall images in 'image-mode' can't be scrolled with 'pixel-scroll-precision-mode' on
Date: Sat, 12 Aug 2023 12:43:58 +0200
User-agent: mu4e 1.10.6; emacs 29.1

Hi Po,

Po Lu <luangruo@yahoo.com> writes:

> Rahguzar <rahguzar@zohomail.eu> writes:
>
>> Hi Po,
>>
>> Po Lu <luangruo@yahoo.com> writes:
>>
>>> I tried to fix this differently on master.  Please see if it resolves
>>> your problem (and other issues with scrolling past large images.)
>>>
>>> As always, keep an eye out for performance regressions.  Thanks.
>>
>>
>> The issue is still there and can be reproduced by evaluating
>>
>> (let* ((win (display-buffer (get-buffer-create 
>> "image-pixel-precision-test")))
>>        (height (* (window-text-height win t) 2))
>>        (file "path/to/image"))
>>   (select-window win)
>>   (erase-buffer)
>>   (insert-image (create-image file nil nil))
>>   (goto-char 1)
>>   (pixel-scroll-precision-mode)
>>   nil)
>>
>> The resulting image cannot be scrolled.
>>
>> In the new code this is because vscroll is reset to 0 inside the binding
>> for `line-after`. Commenting out that line allows me to scroll the
>> image.
>
> But as a repercussion, scrolling past the image will result in the
> window being vscrolled indefinitely.  That is unacceptable, because
> redisplay grows exponentially slower as vscroll increases.
>
> Is this compromise acceptable?  It will enable scrolling within the last
> line of the window, but will reset vscroll entirely once the window
> start becomes invisible, resulting in a visually disconnected ``jump''
> back to the top of that line.
>
> diff --git a/lisp/pixel-scroll.el b/lisp/pixel-scroll.el
> index 488f6781254..8961f196ec7 100644
> --- a/lisp/pixel-scroll.el
> +++ b/lisp/pixel-scroll.el
> @@ -543,14 +543,18 @@ pixel-scroll-precision-scroll-down-page
>          (let ((line-after (save-excursion
>                              (goto-char new-start-position)
>                              (if (zerop (vertical-motion 1))
> -                                (progn
> -                                  (set-window-vscroll nil 0 t t)
> -                                  nil) ; nil means move to 
> new-start-position.
> +                                nil ; nil means move to new-start-position.
>                                (point)))))
>            (if (not line-after)
>                (progn
>                  (goto-char new-start-position)
> -                (signal 'end-of-buffer nil))
> +                ;; If vscroll has resulted in the entire line being
> +                ;; scrolled outside the window's text area, set it to
> +                ;; the height of the last line.
> +                (let ((visibility (pos-visible-in-window-p 
> new-start-position nil t)))
> +                  (unless visibility
> +                    (set-window-vscroll nil 0)
> +                    (signal 'end-of-buffer nil))))
>              (if (pos-visible-in-window-p line-after nil t)
>                  (goto-char line-after)
>                (goto-char new-start-position))))))))


That is much better. Thank you!

I think even better would be to replace the

(set-window-vscroll nil 0)

with

(set-window-vscroll nil current-vs t t)

but that doesn't seem to work and the entire line scrolls out of view
which I agree is undesirable. I don't understand why it doesn't work.
Can you please explain why if possible?

Rahguzar





reply via email to

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