mirror of
https://github.com/rivo/tview.git
synced 2026-04-26 21:35:54 +03:00
[GH-ISSUE #236] Combined emojis don't render correctly #182
Labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/tview#182
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @Bios-Marcel on GitHub (Feb 16, 2019).
Original GitHub issue: https://github.com/rivo/tview/issues/236
Hey,
I do have a terminal that can render emojis, however combined emojis like region flags, different genders of an emoji and differenet skin tones don't actually render as a single emoji. Instead they are two or more seperate emojis and sometimes they leave weird artifacts as well.
Here is what it looks like:
https://cdn.discordapp.com/attachments/484508952948899841/546348622359429120/img.png
He uses iranian flags on both sides.
I am unsure if this is a tview problem though, since I am not very well versed on this topic.
@rivo commented on GitHub (Mar 8, 2019):
I added support for this in #161 so it should theoretically work. But it also depends heavily on your terminal and your OS's support for these emojis. If you can post a short code sample here, I may be able to find out where the problem is.
@Bios-Marcel commented on GitHub (Mar 8, 2019):
Tested using this (It shows my fork in the image, but don't worry, I tested with your repo as well):
My terminal is a VTE terminal.
@rivo commented on GitHub (Mar 9, 2019):
This is what I see on macOS (iTerm2):
So it seems that the second flag is processed correctly because of the zero-width joiner for which I added support a while back. Your terminal doesn't appear to be able to render that flag so it resorts to a fallback (white flag). I think this is correct.
But the German flag is more interesting as it's composed of two unicode characters
0x1f1e9 + 0x1f1ea, which are regional indicators "D" and "E". I didn't even know I needed to detect regional indicators and combine them to flags...At this point, before I hardcode this specific case into
tview, I think I need a full list of rules for composite unicode characters - if there is one. I haven't been able to find such a list yet.I'd appreciate if anyone had pointers.
@rivo commented on GitHub (Mar 19, 2019):
So your issue took me down a huge rabbit hole... I don't know if you are interested in the specifics of what caused this problem and how I ended up solving it (see gdamore/tcell#264 for a discussion). But I even wrote an entire new package to deal with this properly:
rivo/uniseg.In any case, your example (and hopefully all other similar ones) works now:
There may still be an issue with terminals that are not fully up to date with the Unicode specification (especially emojis) but that's nothing I can fix on my end. In those cases, you would have to submit issues with the maintainers of those terminals.
ps. You'll need to update
tcellto make this work properly.@Bios-Marcel commented on GitHub (Mar 19, 2019):
Thanks for looking into this. Seems like my terminal is still not able to do this, but I guess that can't be helped. Thanks anyway!
@normen commented on GitHub (Nov 22, 2020):
By now it looks like cordless has no issues with emoji on the default MacOS Terminal, they seem to work fine for me. My own app based on tview does still have issues though - how did you circumvent the issue? Or did I just not see it?
@Bios-Marcel commented on GitHub (Nov 22, 2020):
For the chatview I currently still use tview.TextArea, so there's nothing I personally did.
@normen commented on GitHub (Nov 22, 2020):
Okay thanks, maybe I just didn't try the right emoji at the right moon phase. Thanks again!
Am 22.11.2020 06:24 schrieb Marcel Schramm:
@justjosias commented on GitHub (Jul 28, 2021):
Downstream problem: https://github.com/RasmusLindroth/tut/issues/38