Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: [BUG] ZLE character width with emoji presentation variation selectors in Unicode



Ah cool - didn't know about the glitch prompt. Thanks for the info!

Hmm, though yep, I was observing that the width reservation seems to be working correctly in the prompt itself but seems to fail for the bracketed paste case (when testing in Kitty for correctness), thus the glitch prompt doesn't entirely help here unfortunately.



On Fri, May 10, 2024 at 4:40 PM Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
On Fri, May 10, 2024 at 10:12 AM Advait Maybhate <advait@xxxxxxxx> wrote:
>
> In fish's case, I believe they use ridiculousfish/widecharwidth which does seem to handle emoji presentation selectors. unicode-width, part of the Rust stdlib, recently added support for correctly reporting the width of these sequences as well: unicode-width/pull/41.

Note that if your primary concern is emojis in prompts (rather than in
text typed as command input), zsh has the %G (for "glitch") prompt
sequence.  So if you write e.g.

PS1="Cloudy %{☁️%2G%}% "

then zsh will correctly reserve 2 positions for the glyph when
calculating the prompt. (Note gmail may have messed up the copy-paste
of the emoji; do it right and it works).


Messages sorted by: Reverse Date, Date, Thread, Author