Search to first selection when wrapping around

Previously the last selection was searched to when really only the
area between the start of the file and the first selection should be
scanned when the select next wraps around from the end of the editor.