realartists / shiphub-cocoa

MIT License
30 stars 5 forks source link

Gendered emoji renders strangely #309

Open kogir opened 7 years ago

kogir commented 7 years ago

It seems some emoji are actually two in sequence. These render strangely:

🤷‍♀️ 🤷‍♂️

The colored hand and people emoji can't be inserted at all.

kogir commented 7 years ago

Oh, that actually looks great in the comment, but showed as two characters in the editor:

🤷‍♂️ =

james-howard commented 7 years ago

This looks like a codemirror issue. I'll file it with them and see if I can develop a patch for it.

james-howard commented 7 years ago

https://github.com/codemirror/CodeMirror/issues/4488

james-howard commented 7 years ago

I've learned that outside of Cocoa native controls, nobody supports these emoji properly. They're basically two logical characters joined by a zero width unicode joiner u200d.

They don't work right in BBEdit, VS Code, Atom, Windows Notepad, Visual Studio, etc.

Specifically in CodeMirror, I've found that they have a special characters regex that matches, probably only incidentally via a range, u200d, this is what causes the emoji to get split into two and the red dot to get drawn. Removing the zwj from the regex helps, it lets it draw correctly, but unfortunately other issues crop up because the number of visual characters != length of the string, and sadly CodeMirror seems pretty tied to this fallacy (as are most implementations outside of Cocoa).