Issue
When emoji with variation selectors (for changing the skin color, etc) are pasted in the editor and deleted, the character for the variation selector can be left behind, essentially becoming an invisible character/zero-width space.
How to reproduce
(Only confirmed in Mac OS X 10.11.6, Sublime Build 3119)
Copy the heart character from http://mts.io/2015/04/21/unicode-symbol-render-text-emoji/ , paste it into Sublime, and delete it with backspace. Note that it takes two presses to delete it fully. If you go between the characters and only delete the visible one, you are left with an invisible character that is nearly impossible to find without a painstaking trudge through the file with the arrow keys, or a hex dump. Initial regex searches for zero-space characters found nothing, but I later found out this certain character could be searched for with [\x{FE0F}]
.
Why it matters
In my case, I was working on a project in react, and the characters were getting rendered in safari, leaving behind a mysterious black box.
Here’s the commit in which I deleted the invisible characters:
I’ve noticed that in apps such as Chrome, TextEdit, etc., these characters are treated properly as a single character and are deleted and selected together.