Fix arrow key selection going off the top/bottom.
Reuse the logic in select() to keep it in range.