Fixed undo for text editor