Subject: bug#50178: 28.0.50; Size of echo area does not account for line-spacing

From: Gregory Heytings <[email-masked]>
Date: Wed, 25 Aug 2021 09:01:20 +0000

>
> To elaborate:
>
> (1) You first have to calculate the maximum permissible pixel height of 
> the echo area window from the character height of the frame where you 
> intend to display the completions and the value of 
> `max-mini-window-height' height as specified for that frame.  Note that 
> for a minibuffer-less frame the echo area window may appear on another 
> frame whose character height you have to use here.
>
> (2) You then have to calculate the pixel height of each completion line 
> as if it were shown in the echo area window mentioned in (1) using 
> `window-text-pixel-size' and add it to some cumulative height until you 
> have exhausted the maximum permissible height calculated in (1).
>

If you can live with the fact that the last visible completion candidate 
is not fully displayed (which is, as Eli said, consistent with what 
happens in other Emacs windows), this complex procedure is not necessary 
anymore.  You can simply set redisplay-adhoc-scroll-in-resize-mini-windows 
to nil and insert "enough" completion candidates.  Emacs will resize the 
window appropriately, and the last completion candidates will not be 
visible.