all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: "Óscar Fuentes" <ofv@wanadoo.es>
Cc: gregory@heytings.org, 50178@debbugs.gnu.org
Subject: bug#50178: 28.0.50; Size of echo area does not account for line-spacing
Date: Thu, 26 Aug 2021 09:34:29 +0300	[thread overview]
Message-ID: <83sfywu32i.fsf@gnu.org> (raw)
In-Reply-To: <878s0pe15w.fsf@telefonica.net> (message from Óscar Fuentes on Wed, 25 Aug 2021 22:10:03 +0200)

> From: Óscar Fuentes <ofv@wanadoo.es>
> Cc: gregory@heytings.org,  50178@debbugs.gnu.org
> Date: Wed, 25 Aug 2021 22:10:03 +0200
> 
> Eli Zaretskii <eliz@gnu.org> writes:
> 
> >> Any graphics environment worth its salt has methods for measuring
> >> whatever object without actually rendering it.
> >
> > So does Emacs: that's what window-text-pixel-size does.
> 
> You missed the part "without actually rendering it".

No, I didn't.  window-text-pixel-size doesn't render the text, it
_simulates_ its rendering internally.  You can look at its source if
you don't believe me.

> As per Martin's instructions, the method for ensuring that the text does
> not overflow the window is to put text on it, one line at a time, and
> watch the used space (I guess that two lines would be enough to
> extrapolate the space required by N lines assuming that the text is
> rendered with the default font, face, etc)

Martin's instructions notwithstanding, I stand by what I wrote.  Yes,
you need a window to compute the metrics, but that's only because some
of the factors that determine the metrics can vary between windows.
The window you pass to window-text-pixel-size doesn't need to be the
same window where you will eventually display the text, it just should
have the same window-specific parameters as the eventual one.

> On the case of ido-grid-mode (which displays a grid N lines tall that
> virtually expands horizontally) not knowing in advance how many lines
> are available means that it must populate the mini window with some
> dummy text to measure its capacity, throw away its contents and proceed
> to fill the mini window with the real payload.

Your conclusions are incorrect.

Are you familiar with fit-window-to-buffer?  Do you know that Help
commands use that every time to dynamically decide how to size the
window showing help?  If so, doesn't the fact that this mechanism
exists and works contradict your conclusions from what was said here?

> >> Why that was implemented that way? (instead of using pixels, for
> >> instance.)
> >
> > Because in most cases it's more useful: it approximates the actual
> > number of lines quite well.
> 
> Exactly, that was my point all along. And it would be a better
> approximation if the display engine used that variable taking into
> account line-spacing and other relevant settings which affect how the
> actual text is rendered.

I said "in most cases".  It is impossible to do that in all cases.
The case you are talking about is one of the rare exceptions.





  reply	other threads:[~2021-08-26  6:34 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
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 [this message]
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

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

  git send-email \
    --in-reply-to=83sfywu32i.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=50178@debbugs.gnu.org \
    --cc=gregory@heytings.org \
    --cc=ofv@wanadoo.es \
    /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 external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.