Subject: Re: bug#47860: 28.0.50; Mini buffer resize when lines are truncated regression

From: Aaron Jensen <[email-masked]>
Date: Mon, 19 Apr 2021 11:19:06 -0500

On Mon, Apr 19, 2021 at 10:13 AM Aaron Jensen <[email-masked]> wrote:
>
> If you're willing to install selectrum, it would be helpful if you
> could at least verify the behavior I'm seeing so that I do not think
> I've gone mad. This reproduces the problem for me on master, but not
> on emacs-27. Specifically, on emacs-27, I see both aaaa... and bbbb...
> visible in the minibuffer, but on master, I only see aaa....

Okay, here's a selectrum-free repro that, on emacs 27 shows all 3
lines and on emacs 28 shows only two lines:

(defun foo--set-window-height (window &optional height)
  (let ((dheight (or height (cdr (window-text-pixel-size window))))
        (wheight (window-pixel-height window))
        (window-resize-pixelwise t))
    (window-resize
     window (- dheight wheight) nil nil 'pixelwise)))

(setq hook
      (lambda nil
        (remove-hook 'minibuffer-setup-hook hook)
        (setq-local auto-hscroll-mode nil)
        (setq-local foo--candidates-overlay
                    (make-overlay (point) (point) nil
                                  'front-advance 'rear-advance))
        (setq-local truncate-lines t)
        (setq minibuf-after-string "
\naaa\nbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb\ncccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc")
        (move-overlay foo--candidates-overlay
                      (point-max) (point-max))
        (put-text-property 0 1 'cursor t minibuf-after-string)
        (overlay-put foo--candidates-overlay
                     'after-string minibuf-after-string)
        (foo--set-window-height (active-minibuffer-window))))

(unwind-protect
    (progn
      (add-hook 'minibuffer-setup-hook hook t)
      (read-from-minibuffer "test: "))
  (remove-hook 'minibuffer-setup-hook hook))

Screenshot from 27:

https://cln.sh/G5j1zB

Screenshot from 28:

https://cln.sh/2QOHD0

Please let me know if you can repro as I've demonstrated