Subject: bug#70038: 29.3.50; Shift up/down in buffer with images on M-x other-window with some fonts

From: Ramon Diaz-Uriarte <[email-masked]>
Date: Thu, 28 Mar 2024 17:59:51 +0100

Actually, maybe I can claim those bonus points: this does not depend on fonts, though I am triggering it using the package vertico (so maybe this example is vertico's fault):

Steps:

1. emacs -Q
2. eval this code

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(package-initialize)
(vertico-mode 1)

(progn
  (defun pin-vscroll-down (win)
    (set-window-vscroll win 200 t))
   (let* ((height (/ (* 2 (frame-pixel-height)) 15))
         (image1 (create-image "/tmp/image1.png" nil nil :height height))
         (image2 (create-image "/tmp/image2.png" nil nil :height height))
         (image3 (create-image "/tmp/image3.png" nil nil :height height)))
    (with-current-buffer (get-buffer-create "*image-scroll-test*")
      (insert " \n \n \n \n \n \n")
      (put-image image1 1)
      (put-image image2 5)
      (put-image image3 9)
      ;; With larger image sizes (goto-char 3)
      ;; also consistently triggers the problem.
      (goto-char 11)
      (add-hook 'pre-redisplay-functions #'pin-vscroll-down nil t))
    (split-window-right)
    (other-window 1)
    (switch-to-buffer "*image-scroll-test*")))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

3. Do `M-x` (or C-x b). No need to execute anything or switch buffers, just have the minibuffer show options.

4. `C-x o`  a few times. You'll see the images move up and down.

I am seeing this in Lucid and GTK builds.

Best,

R.

On Thu, 28-March-2024, at 17:12:45, Ramon Diaz-Uriarte <[email-masked]> wrote:
>> In that case, I don't understand what the font has to do with this: if
>> redisplay resets the window's vscroll, it should always do that, no?
>> Also, I don't have the fonts you used, so I cannot try the recipe as
>> is.  I tried a few monospaced fonts I do have, and couldn't reproduce.
>> A recipe that doesn't depend on rare fonts would be appreciated.
>> Bonus points for providing a recipe that doesn't depend on fonts at
>> all.
>> 
>> Thanks.
>
> I am afraid I don't get the bonus points, because all simple recipes I've found so far depend on fonts (even more, on the "rare fonts", which I use routinely.)
>
> Best,
>
> R.

-- 
Ramon Diaz-Uriarte
Department of Biochemistry, Lab B-31
Facultad de Medicina 
Universidad Autónoma de Madrid 
Arzobispo Morcillo, 4
28029 Madrid
Spain

Phone: +34-91-497-2412

Email: [email-masked]
       [email-masked]
       [email-masked]

https://ligarto.org/rdiaz