Add spec for undo, fix undo with transaction

Do all inserting in a transaction so that a single undo step undoes
entire empty line insertion.