Returns the selection end position for undo or redo operations.
The selection end position, or null if no selection exists.
If true, returns the undo selection end; if false, returns the redo selection end.