Replies: 4 comments
-
|
I totally understand and agree, the results of my ucs-detect library so far (and preliminary results from a more detailed WIP branch) show terminal support varies more wildly than expected. I expected each terminal to mostly match a specific unicode release, and implemented UNICODE_VERSION for that. But there are countless examples where Emoji, Zero-width, and combining character tables of a terminal are incomplete and the unicode versions of each table are different! I have proposed a complex solution in another issue, here, #123 (comment)
And the very bottom of this issue, #104 (comment)
It's pretty advanced, however, this would allow us to precisely predict or measure the width of all possible sequences on each individual terminal with more perfect accuracy. |
Beta Was this translation helpful? Give feedback.
-
|
Just to come back to say the results of testing terminals for RGI (Recommened for General Interchange) is at https://ucs-detect.readthedocs.io/results.html -- less than half of terminals support RGI emojis. It is necessary to interact with a terminal using CPR (Cursor Position Report) to determine their support for RGI / Emoji with ZWJ, in the way that the ucs-detect tool does. |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
|
I have experimented with, at least, validate now to follow ASCII/CJK with ZWJ and an Emoji, and I decide even against that. My final decision is that non-recommended Emoji Sequences, like TREE+ZWJ+SNOWFLAKE, will measure as width 2 in python wcswidth. Even though they will likely display as two non-joined emojis side-by-side on most TE's like Konsole. But I consider this in the area of "glitch emoji" or undefined behavior. If wcwidth were never to make another release, but a new ZWJ emoji becomes popular in years future the current implementation is forward-compatible and requires no change, so that's a nice bonus. |
Beta Was this translation helpful? Give feedback.

Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi Jeff,
imho, one of the many problems of getting Emoji widths right is that there are multiple definitions of what an Emoji sequence can look like to be considered an Emoji. The standard defines an recommended set here:
https://www.unicode.org/reports/tr51/#def_rgi_set
but it also defines variations of it (in
emoji-test.txt, listed here) and more importantly, allows arbitrary Emoji sequences which are still considered valid.However, probability is low that non-recommended Emoji will ever gain so much popularity that terminals would need to display them as a single width-2-Emoji, so there will always be the case, that some Emoji sequences should be displayed as an (actual) sequence of separate basic Emoji. That is the reason I made Emoji handling configurable in the latest release of unicode-display_width.
I did some manual testing and was surprised to learn that most terminals (gnome-terminal, vscode terminal etc.) would not display most Emoji sequences (the exception being popular terminals on macOS). I also noted that is very unpleasant to work with software that measures RGI-Emoji sequences correctly, but the terminal displays them as separate Emoji. I am trying to automatically detect the terminal used to provide a good out-of-box experience, but probably, a run-time check (like ucs-detect does) would be more reliable.
Condensing the above remarks into a single question/issue, it would be:
Should wcwidth() / the wcwidth spec support different string width mechanisms for RGI and non-RGI Emoji?
Beta Was this translation helpful? Give feedback.
All reactions