zsh-workers
 help / color / mirror / code / Atom feed
From: Advait Maybhate <advait@warp.dev>
To: Mikael Magnusson <mikachu@gmail.com>
Cc: zsh-workers@zsh.org
Subject: Re: [BUG] ZLE character width with emoji presentation variation selectors in Unicode
Date: Mon, 13 May 2024 20:08:33 -0400	[thread overview]
Message-ID: <CAN+tYMcM67-GffCEwnBa+DzbjvSdPEFi9F7Zbahgo1cOvW7k3w@mail.gmail.com> (raw)
In-Reply-To: <CAHYJk3Q3dEbG1acC4JxGjfRMFewWotjbV4MWLuxSeRh27pHm0w@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 2292 bytes --]

Agreed that there's no particular phrasing for this in the Unicode spec wrt
the exact width differences. I believe that'll largely be left up to the
renderer (in web, mobile, desktop, etc. contexts).

Given that, it seems like the optimal path forward might be to ask the
terminal emulator for this information to ensure alignment in what the
shell thinks vs. the terminal (for widths)?

Gotcha re composing characters - that makes sense, thanks for explaining!

But yep, I've got a fallback mechanism here in mind for Zsh (render as 2
cells wide but only reserve 1 cell, to match the shell, similar to iTerm) -
my goal with opening this issue was to kick off a discussion on the
"correct" way to approach this in Zsh and how to best support this going
forward. Since the current experience I've got in mind is suboptimal for
Zsh (compared to Bash/Fish) within Warp, for example, due to these
limitations.

Best,
Advait

On Fri, May 10, 2024 at 2:57 PM Mikael Magnusson <mikachu@gmail.com> wrote:

> On Fri, May 10, 2024 at 7:12 PM Advait Maybhate <advait@warp.dev> wrote:
> >
> > Gotcha, thanks for the context! Combining emojis are weird :)
> >
> > Hmm, agreed that it won't be possible to use the same standard across
> all terminals - hence, I was thinking terminfo would allow the terminal to
> indicate whether it supports these variation selectors with wide characters?
> >
> > Yep, I was referencing TR51 from Unicode as well (emoji presentation
> selectors).
>
> From what I could tell (I'm not an expert), there is no phrasing that
> implies the width should be different for the emoji presentation form
> and the text presentation form.
>
> > From looking a bit into wcwidth, it seems like it doesn't inherently
> support width for a sequence of code points. I just tried this out in C++
> with ICU (International Components for Unicode library) and grapheme
> clusters to demonstrate the width calculation as 2 with this sequence:
> gist.github.com/Advait-M/a326cd2e474b9520dc893765ec4cb2c4.
>
> Yes, normal compose sequences are a base character with a width, and
> composing characters with 0 width (but effectively rendering to the
> left of the insertion point, on top of the base character.)
>
> --
> Mikael Magnusson
>

[-- Attachment #2: Type: text/html, Size: 2908 bytes --]

  reply	other threads:[~2024-05-14  0:09 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-09 14:45 Advait Maybhate
2024-05-10  9:37 ` Mikael Magnusson
2024-05-10  9:54   ` Mikael Magnusson
2024-05-10 17:11     ` Advait Maybhate
2024-05-10 18:57       ` Mikael Magnusson
2024-05-14  0:08         ` Advait Maybhate [this message]
2024-05-10 20:40       ` Bart Schaefer
2024-05-14  0:04         ` Advait Maybhate

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=CAN+tYMcM67-GffCEwnBa+DzbjvSdPEFi9F7Zbahgo1cOvW7k3w@mail.gmail.com \
    --to=advait@warp.dev \
    --cc=mikachu@gmail.com \
    --cc=zsh-workers@zsh.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.vuxu.org/mirror/zsh/

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 NNTP newsgroup(s).