Flip the sense of the __cursor_invalid function to __cursor_valid
(thinking not-not-valid was making my head hurt).

Rewrite the cursor search operation to look like search-near, where
we test for a match first, rather than last.

Rewrite the cursor random-next operation to look like search-near,
just for consistency.