Undo/Redo bug fix

Fixed bug where redo was inserting text into wrong location since
cursor had been moved by user.  Also fixed bug where not all undo
actions were available after branching the undo/redo log.