Fixed bug where the undo state wasn't updated until the end of a typing level.