Restore correct selection when region changed at end of selection

Fixes #1002314