Overview
The search feature allows you to:- Search through terminal output and scrollback history
- Use literal text or regular expressions
- Toggle case sensitivity
- Navigate between matches with keyboard shortcuts
- See match count and position
- Visual highlighting of all matches
Opening Search
Via Command:Search Interface
Location: Top-right overlay (width: 320px, height: 36px) Components:- Input field - Enter search query
- Match counter - Shows “X of Y” or “No matches”
- Navigation buttons - Up/down arrows to move between matches
- Close button - X to close search
Search Modes
Literal Search (Default)
Searches for exact text matches:Regex Search
Enable regex mode to use regular expressions:Case Sensitivity
Default: Case-insensitiveNavigation
Keyboard Navigation
Enter- Next match (toward older content)Shift+Enter- Previous match (toward newer content)Escape- Close search
Button Navigation
- Up arrow (↑) - Next match (scrolls up toward history)
- Down arrow (↓) - Previous match (scrolls down toward recent output)
Menu Commands
- Edit > Find Next (
SearchNext) - Edit > Find Previous (
SearchPrevious)
Match Ordering
Matches are ordered newest-first, with index 0 being the bottommost (most recent) match.
- Bottom of screen = newest output
- Top of screen = older output
- Scrollback history extends upward
Search Scope
Termy searches:- Visible terminal - Current viewport
- Scrollback history - All scrollback up to the configured limit
- Grid cells converted to text
- Control characters replaced with spaces
- Wide characters handled correctly (CJK, emoji)
Search Debouncing
Searches are debounced to improve performance:- Search doesn’t trigger on every keystroke
- 150ms delay after you stop typing
- Reduces CPU usage during fast typing
Implementation Details
Search Engine
Location:crates/search/src/
Core Components:
Match Results
Location:crates/search/src/matcher.rs
State Management
Location:crates/search/src/state.rs
View Integration
Location:src/terminal_view/search.rs
Unicode Support
Termy’s search engine properly handles:Wide Characters (CJK)
Emoji
Combining Characters
Error Handling
Invalid Regex
If you enter an invalid regex pattern:No Matches
When no matches are found:Visual Highlighting
Matches are highlighted in the terminal:- All matches - Highlighted throughout terminal
- Current match - Additional emphasis on selected match
- Scrollbar markers - Matches shown as markers on scrollbar
- Immediately when search changes
- As new terminal output arrives
- When scrolling through results
Performance
Optimizations
Debounced Search:- Prevents excessive searches while typing
- 150ms delay improves responsiveness
- Only searches when pattern changes
- Reuses compiled regex across searches
- Efficient cell-to-text conversion
- Only scrolls if match is not visible
- Minimal scroll distance to reveal match
- Preserves scroll position when possible
Large Scrollback
With large scrollback buffers (10,000+ lines):- Search may take a few hundred milliseconds
- Debouncing prevents UI lag during typing
- Results are computed once and reused for navigation
Use Cases
Finding Errors
Tracking IDs
Log Analysis
File Paths
Best Practices
Effective Queries
Use specific terms:Regex Tips
Common patterns:\:
Troubleshooting
Search Not Finding Results
Check:- Case sensitivity setting
- Search mode (literal vs regex)
- Pattern syntax (if using regex)
- Scrollback limit (results might be outside history)
Regex Errors
Common regex mistakes:Performance Issues
If search is slow:- Reduce scrollback: Lower
scrollback_historysetting - Simplify regex: Complex patterns take longer
- Clear terminal: Less content = faster search
Keyboard Shortcuts Summary
| Action | Default Binding |
|---|---|
| Open search | Cmd+F (macOS) / Ctrl+F |
| Next match | Enter |
| Previous match | Shift+Enter |
| Close search | Escape |
| Toggle case sensitivity | (Via command) |
| Toggle regex mode | (Via command) |
Related
- Keyboard Shortcuts - Search keybindings
- Configuration - Configure scrollback size
- GPU Acceleration - Search highlighting rendering