If a selection contains text from outside the regions and the selection is ended inside a region, the selected text outside the region is returned. Note that it doesn't happen with the highlights. The highlights work as expected.