From: Eli Zaretskii <eliz@gnu.org>
To: Jimmy Yuen Ho Wong <wyuenho@gmail.com>
Cc: emacs-devel@gnu.org
Subject: Re: Need `truncate-string-to-pixel-width` and `glyph-pixel-width` functions in C
Date: Thu, 24 Oct 2024 17:39:57 +0300 [thread overview]
Message-ID: <86msitd0oy.fsf@gnu.org> (raw)
In-Reply-To: <CAKDRQS6_n57+cnJWtGdU-Qp2VLqUe8oRxWyxgOdOxka8p1-_bQ@mail.gmail.com> (message from Jimmy Yuen Ho Wong on Thu, 24 Oct 2024 15:26:46 +0100)
> From: Jimmy Yuen Ho Wong <wyuenho@gmail.com>
> Date: Thu, 24 Oct 2024 15:26:46 +0100
> Cc: emacs-devel@gnu.org
>
> If the above is what you want, and since the popup is actually a
> frame, my first suggestion would be to use :align-to display property
> on the whitespace between the <candidate>s and the <Type>s. Did you
> try that?
>
> The advantage of :align-to is that you don't have to measure the
> pixel-width of the candidate names, only the pixel-width of each
> <Type> string (to correctly set up the offset from the right edge of
> the text area) -- the rest will be done by the display engine. And
> the display engine always does everything in pixel resolution.
>
> The current implementation wraps every line with some additional margin and a custom thin scrollbar after
> formatting, both are propertized strings with a display space property, before giving the final result to a buffer
> and then the child frame. Letting the windowing system to do truncation will truncate off the custom scrollbar
> and margin first, in addition to breaking an existing API that downstream extension packages rely on and
> being a much larger refactoring that will bring forth the much thicker and intrusive default Emacs scroll bars.
> Otherwise, this will work.
If the scroll bar and the margin are generated programmatically, then
presumably the program which creates them knows their width, or can
calculate that? If so, the :align-to value should take that into
consideration.
(Assuming I understood what you were describing.)
next prev parent reply other threads:[~2024-10-24 14:39 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-23 5:01 Need `truncate-string-to-pixel-width` and `glyph-pixel-width` functions in C Jimmy Yuen Ho Wong
2024-10-23 8:01 ` Eli Zaretskii
2024-10-23 13:52 ` Jimmy Yuen Ho Wong
2024-10-23 17:39 ` Eli Zaretskii
2024-10-23 20:03 ` Jimmy Yuen Ho Wong
2024-10-24 9:55 ` Eli Zaretskii
2024-10-24 14:26 ` Jimmy Yuen Ho Wong
2024-10-24 14:39 ` Eli Zaretskii [this message]
2024-10-24 15:33 ` Jimmy Yuen Ho Wong
2024-10-24 16:02 ` Eli Zaretskii
2024-10-24 16:49 ` Jimmy Yuen Ho Wong
2024-10-24 17:56 ` Eli Zaretskii
2024-10-24 21:11 ` Jimmy Yuen Ho Wong
2024-10-25 7:21 ` Eli Zaretskii
2024-10-25 13:35 ` Jimmy Yuen Ho Wong
2024-10-25 15:11 ` Eli Zaretskii
2024-10-28 20:21 ` Jimmy Yuen Ho Wong
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=86msitd0oy.fsf@gnu.org \
--to=eliz@gnu.org \
--cc=emacs-devel@gnu.org \
--cc=wyuenho@gmail.com \
/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).