Making text input feel right is a lot of work, but it's paying off. This video demonstrates the same cursor and selection code being applied to two separate data structures, neither of which is a buffer of chars.
Tonight I made my regex builder distinguish between "insert index" and "cursor index/position", which allows me to display the cursor on the right or left side of an element without affecting how inserts and deletes work.