From: Daniel Mendler <mail@daniel-mendler.de>
To: Lars Ingebrigtsen <larsi@gnus.org>
Cc: 47712@debbugs.gnu.org
Subject: bug#47712: 27.1; Provide `string-display-width` function, which takes properties into account, `substring-width`
Date: Mon, 12 Apr 2021 11:08:52 +0200 [thread overview]
Message-ID: <7c96d858-7947-0cca-60fc-1f6d027bb909@daniel-mendler.de> (raw)
In-Reply-To: <87h7kbzxwh.fsf@gnus.org>
On 4/12/21 10:53 AM, Lars Ingebrigtsen wrote:
> I can see how that may be useful in some cases (and is very different
> from `window-text-pixel-size'), so I think adding something like that
> would be nice. But the name is confusing -- it sounds like it's
> computing the displayed width, and it's not -- if there's images or text
> with a different font in there, it's not taken into account?
Yes, a better name could be `string-property-width`? I proposed
`string-display-width` since it takes the 'display property into
account, but maybe this gives false associations.
Note that I would like to have an implementation of
`substring-width`/`string-display-width`/`substring-display-width` which
does not allocate, since this reduces the GC pressure when formatting
many items. How do you think about this?
Regarding images, different fonts, maybe a `string-property-pixel-width`
would be useful too. But for the use cases I have in mind (formatting
monospaced text) computing columns is sufficient.
next prev parent reply other threads:[~2021-04-12 9:08 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-11 21:16 bug#47712: 27.1; Provide `string-display-width` function, which takes properties into account, `substring-width` Daniel Mendler
2021-04-12 2:26 ` Eli Zaretskii
2021-04-12 8:45 ` Daniel Mendler
2021-04-12 8:53 ` Lars Ingebrigtsen
2021-04-12 9:08 ` Daniel Mendler [this message]
2021-04-13 8:01 ` Lars Ingebrigtsen
2021-04-13 12:00 ` Eli Zaretskii
2021-04-13 12:25 ` Daniel Mendler
2021-04-14 8:50 ` Eli Zaretskii
2021-04-14 10:49 ` Daniel Mendler
2021-04-14 11:38 ` Eli Zaretskii
2021-04-12 12:21 ` Eli Zaretskii
2021-04-12 12:50 ` Daniel Mendler
2021-04-12 13:21 ` Eli Zaretskii
2021-04-12 13:32 ` Daniel Mendler
2021-04-12 13:40 ` Eli Zaretskii
2021-04-12 14:05 ` Daniel Mendler
2021-04-12 14:15 ` Eli Zaretskii
2021-04-12 14:32 ` Eli Zaretskii
2021-04-12 14:38 ` Daniel Mendler
2021-04-12 17:01 ` Eli Zaretskii
2021-04-12 17:18 ` Daniel Mendler
2021-04-13 7:06 ` martin rudalics
2021-04-13 12:23 ` Eli Zaretskii
2021-04-12 14:36 ` Daniel Mendler
2021-04-12 17:09 ` Eli Zaretskii
2021-04-12 17:13 ` Daniel Mendler
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=7c96d858-7947-0cca-60fc-1f6d027bb909@daniel-mendler.de \
--to=mail@daniel-mendler.de \
--cc=47712@debbugs.gnu.org \
--cc=larsi@gnus.org \
/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).