fix(terminal): avoid integer overflow in selectPrev with no active matches (#12936)
Also found when test searching.
Run Ghostty debug on macOS and follow these steps:
1. Open Ghostty, `cat src/Surface.zig` and start search
`self.startClipboardRequest`.
2. Click up button(Press enter) 6 times and click down button (Press
shift+enter) 6 times.
3. You should see a panic crash.
### AI Disclosure
Claude implemented the fix and the unit test.
I reviewed it and tested it myself.