unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: "Óscar Fuentes" <ofv@wanadoo.es>
To: martin rudalics <rudalics@gmx.at>
Cc: 50178-done@debbugs.gnu.org
Subject: bug#50178: 28.0.50; Size of echo area does not account for line-spacing
Date: Wed, 25 Aug 2021 12:49:39 +0200	[thread overview]
Message-ID: <87k0k9er3w.fsf@telefonica.net> (raw)
In-Reply-To: <a668ca4a-690e-82fd-7374-31d30b2ff9cb@gmx.at> (martin rudalics's message of "Wed, 25 Aug 2021 09:49:11 +0200")

martin rudalics <rudalics@gmx.at> writes:

>>> It must know and handle every setting that affects line height, current
>>> and future. It would be handy if Emacs provided a function that does
>>> that.
>>
>> We already have it: window-text-pixel-size.
>
> 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).

Thanks. That's too complicated and looks like there are quite a bit of
hidden traps, so for the time being I'll set line-spacing to nil.

On true pixel-oriented systems there are APIs for querying the display
engine about several metrics. Then you can place the text at certain
pixel coordinates. Emacs, however, is a Frankenstein system, that uses
pixels (on graphic frames) but the text positioning depends on previous
text, i.e. for vertical positioning it is a line-based, not pixel-based,
system. Therefore, when you just need to output some lines, you must
deal with pixels, translate back to lines and, to add insult to injury,
resort to post-facto information.

As useful as it would be an API that returns how many lines fit on a
given window. Or, on this case, max-mini-window-height being a true
indication of the capacity of the mini window on terms of the current
display settings, which is what the users want 99.9% of the time.

Closing.





  parent reply	other threads:[~2021-08-25 10:49 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-24  2:08 bug#50178: 28.0.50; Size of echo area does not account for line-spacing Óscar Fuentes
2021-08-24 11:58 ` Eli Zaretskii
2021-08-24 13:34   ` Óscar Fuentes
2021-08-24 16:20     ` Eli Zaretskii
2021-08-24 17:44       ` Óscar Fuentes
2021-08-24 18:13         ` Eli Zaretskii
2021-08-24 18:38           ` Óscar Fuentes
2021-08-24 18:49             ` Eli Zaretskii
2021-08-24 19:36               ` Óscar Fuentes
2021-08-25  2:24                 ` Eli Zaretskii
2021-08-25  7:49                   ` martin rudalics
2021-08-25  9:01                     ` Gregory Heytings
2021-08-25 10:49                     ` Óscar Fuentes [this message]
2021-08-25 12:15                       ` Eli Zaretskii
2021-08-25 14:33                       ` Gregory Heytings
2021-08-25 17:09                         ` Óscar Fuentes
2021-08-25 17:57                           ` Eli Zaretskii
2021-08-25 20:10                             ` Óscar Fuentes
2021-08-26  6:34                               ` Eli Zaretskii
2021-08-26  7:54                       ` martin rudalics
2021-08-26  8:12                         ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87k0k9er3w.fsf@telefonica.net \
    --to=ofv@wanadoo.es \
    --cc=50178-done@debbugs.gnu.org \
    --cc=rudalics@gmx.at \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).