Add undo and redo together when possible