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

From: Óscar Fuentes <[email-masked]>
Date: Tue, 24 Aug 2021 19:44:37 +0200

Eli Zaretskii <[email-masked]> writes:

>> IMO max-mini-window-height, when set to an integer, should mean "I want
>> this many lines", as it does when line-spacing is nil.
>
> But that's not the exact meaning of the value of that variable.  The
> doc string says:
>
>   If an integer, it specifies the maximum height in units of the
>   mini-window frame’s default font’s height.     ^^^^^^^^^^^^^^^
>   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>
> It is measured in units of the canonical character height, and that
> doesn't take the line-spacing into account, like it doesn't take into
> account faces that change the font or the size of the characters.
>
> IOW, the value means "this many lines", but assuming that the line's
> height is the one you get with the frame's default font.

IMAO the case where the user wants to ensure that the mini window is
capable of displaying at least X lines is much more common than the user
wanting a height of at least X times the default font's height.
Crucially, the first case is about showing information, while the second
is about aesthetics (suppossing that it is used at all with that
intention.)

I suspect that max-mini-window-height was introduced with the former use
case in mind, but was not updated when line-spacing was implemented
later.

If we have no method for ensuring that the echo area is capable of
displaying at least X lines (within some reasonable limits) then we need
one.

> You get the same in a window other than mini-window: if you set
> line-spacing, chances are the last screen line will be only partially
> visible.  Why should the mini-window be different? it's just another
> window.

You can't navigate around on the contents of the mini-window. If a
package can't rely on setting max-mini-window-height for showing certain
number of lines on the mini-window, then it must implement vertical
scrolling, which makes things complex both on the programming side and
on the UI side, just to make sure that the user can access the content's
of the overflowing line(s), if any.

The case of ido-grid-mode is glaring: it has a defcustom for setting how
many lines to show. When the command is invoked, it sets
max-mini-window-height accordingly (what else could it do?) but if
line-spacing is not nil, the bottom line(s) might not be visible.