Store selections with all operations.

This way we can recover the selection on Undo/Redo.