Fixed undo so it never goes back to previous document in editor