[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Set-window-vscroll sometimes doesn't work
From: |
Yuan Fu |
Subject: |
Set-window-vscroll sometimes doesn't work |
Date: |
Sat, 17 Oct 2020 20:35:00 -0400 |
Normally if you scroll back onto an image, the image appears completely. I want
to instead only show part of the image, like what pixel scrolling would do. If
everything works as expected I should only see the bottom of the image, instead
I see the whole image.
It seems to be because (set-window-vscroll nil (- img-height
(frame-char-height)) t) didn’t take effect, if you call that again with M-: or
wrap it in (run-with-timer), then it works as expected.
Is this caused by some redisplay optimization or something?
Code:
(progn
(switch-to-buffer (get-buffer-create "test"))
(erase-buffer)
(insert "\n\n")
(insert-image (create-image "abby road.jpeg" nil nil :scale 0.1)
"x")
(insert "\n")
(let ((after-img (point)))
(set-window-start nil (point))
(scroll-down 1)
(let* ((img (plist-get (text-properties-at (window-start)) 'display))
(img-height (cdr (image-size img t))))
(set-window-vscroll nil (- img-height (frame-char-height)) t))))
Yuan
Image used in the code:
- Set-window-vscroll sometimes doesn't work,
Yuan Fu <=
- Re: Set-window-vscroll sometimes doesn't work, Eli Zaretskii, 2020/10/18
- Re: Set-window-vscroll sometimes doesn't work, Yuan Fu, 2020/10/18
- Re: Set-window-vscroll sometimes doesn't work, Eli Zaretskii, 2020/10/18
- Re: Set-window-vscroll sometimes doesn't work, Yuan Fu, 2020/10/18
- Re: Set-window-vscroll sometimes doesn't work, Eli Zaretskii, 2020/10/18
- Re: Set-window-vscroll sometimes doesn't work, Yuan Fu, 2020/10/18
- Re: Set-window-vscroll sometimes doesn't work, Yuan Fu, 2020/10/18
- Re: Set-window-vscroll sometimes doesn't work, Eli Zaretskii, 2020/10/18
- Re: Set-window-vscroll sometimes doesn't work, Yuan Fu, 2020/10/18
- Re: Set-window-vscroll sometimes doesn't work, Eli Zaretskii, 2020/10/18