UndoManager: restore restore selection

Restore the restore selection behavior (but enhanced).

See also this bug:
https://bugzilla.gnome.org/show_bug.cgi?id=672893

The bug was fixed in commit ee95815f8e450f107fcedd00351c16911ce03cea,
but there was a regression:
- select some text and delete it
- undo -> the selection is restored, ok
- click somewhere else or select some text somewhere else
- redo
- undo -> the selection is not restored correctly, the "somewhere else"
  is restored instead, which can be far away from the deleted text.

It's now fixed.
docs: improve undo/redo documentation