UndoManager: restore restore selection (wip)

Restore the restore selection behavior (but enhanced).
docs: improve undo/redo documentation