On the emoji color (skintone) modifier... A normal person wants to select their emoji from a set. Only a programmer would allow the user to input a tiny program with a symbol and a color modifier and then interpret it.
If you want to make text editing a little easier, treat every character along with any style applied to it as a single entity. This way you avoid a lot of potential problems like in TFA as well as things like nesting of modifiers that may not be allowed to overlap - output those when all the characters are complete. In other words, don't track tags but generate them as a post-process when storing the data.
Yeah, the "Bad #2" example, how Chrome does it, makes perfect sense and seems correct to me. Modifiers get removed when the character they're modifying is removed. I would say leaving the modifier and applying it to the previous character would be certainly incorrect (unless you're in a hex editor, in which case combining the bytes as emoji at all is questionable). Imagine it were two different emojis and a skin color modifier after the last one (and somehow, through a rendering bug, the skin color modifier hadn't auto-combined) - OP's precedent for what happens when deleting the middle emoji would move the modifier to the first emoji! Clearly wrong, especially if it then decides to auto-combine.
I mean, the example is pretty contrived in the first place:
> Whoops, I didn't mean to put the a there.
How in the world are you typing emoji such that you have to add the skin color modifier separately that would even afford an opportunity for an errant character to get inserted between? Windows numpad alt codes?
I second that. Half of these “issues” arise from the fact that author is a programmer-y person and knows how unichars work. Normal people have no clue and completely no expectations on that matter, and don’t wanna have.
Neither do I. If I’d fuck my emoji up in such way, I’d just expect to backspace it and type it from scratch. No need to spend mythical man-epochs on a trivia nobody really cares of.
If you want to make text editing a little easier, treat every character along with any style applied to it as a single entity. This way you avoid a lot of potential problems like in TFA as well as things like nesting of modifiers that may not be allowed to overlap - output those when all the characters are complete. In other words, don't track tags but generate them as a post-process when storing the data.