-
Notifications
You must be signed in to change notification settings - Fork 37
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Widgets don't compute correct width for Emoji sequences #64
Comments
Oof, that's a challenging problem. Mordant already goes farther than a lot of terminal libraries and has its own wcwidth implementation that I parse from the unicode standard. But it doesn't handle all of the elaborate emoji constructs. I'd absolutely accept a PR to handle more of these cases. |
If you assume that emoji sequences can always be displayed as a single emoji you only need to detect those clusters. |
Unicode has a lot of rules for grapheme sequences beyond just emoji, many of which (e.g. combining character sequences) mordant already handles correctly. I added tables for the Emoji Sequences and Emoji ZWJ sequences, but most typefaces don't implement all of the sequences, and even the ones that do all use non-cell-aligned glyphs for some of the emoji (like the larger family emojis). So there's no way to produce a perfect result, but this is probably the best we can do. |
Sorry for not having responded. Don't have much time currently. But big thanks to you for implementing this feature! |
If you render a Widget, e.g. a grid, emoji sequences like
seem to render with an incorrectly rendered width.
Sample:
Above code renders as:
whereas the words "SED DIAM NONUMY" of the second column appear too much to the left.
The text was updated successfully, but these errors were encountered: