Search that feels immediate
Shell history can be large, repetitive, and multiline. I built incremental reverse search with debounced input and cached results so each keystroke updates the interface without overwhelming the terminal render pipeline.
- Implemented Ctrl+R incremental matching.
- Added input debouncing and result caching.
- Preserved predictable keyboard navigation in the terminal.
A reusable state model
The original hook was too specialized for one history source. I refactored it into a generic provider that could support both command history and prompt history without duplicating search behavior.
- Separated search state from presentation.
- Reused the provider across shell and prompt history.
- Kept the API compatible with the surrounding React Ink application.
Multiline terminal rendering
A useful match still fails if the user cannot see the relevant part. I added context-aware windowing and expand/collapse behavior around matched text, then fixed wrapping and inherited-color bugs found during review.
- Added an expandable multiline suggestion renderer.
- Centered the visible window around matched content.
- Covered search and expansion flows with snapshot tests.