Wrap undo/redo in an operation