Fixes for multiple-tag-insert case:
* Make newlyInserted be an array of hashes so we don't have to combine the elementInserts and textInserts objects.
* Fix condition in for loop when moving leftward.
* Don't skip newly-inserted elements when moving leftward.
* Just continue around the loop to find the next element after finding text.
* Emit replaces before inserts, since replace positions will also assume that inserts haven't happened yet.