I don’t think you actually want to do what you think you want to do. I understand why and what you want to represent, but for a package you have to consider the broadest possible set of use cases.
Atom is a code editor with monospaced font. Some languages and some developers make use of the even spacing to implement visual systems of organization in their code files. It is entirely possible that your package will come to be used by one of those people in one of those documents, in which case it would be disruptive to insert text that’s supposed to have been deleted just to show the difference.
Since all you need is to display the removed text and highlight the added text, you can mark the
Range of the inserted text and add a
Decoration to change the color of that range and an
overlay (using the same function) to create a tooltip that displays the deleted text. And you can add the
.tooltip class to the overlay item so that it uses Atom’s native tooltip styling and your package looks natural.
That’s actually a feature of the