Conversation
There was a problem hiding this comment.
Pull request overview
This PR adds fuzzy find functionality with match highlighting to the search feature. Users can now see matched characters highlighted (bold + underlined) when searching for systemd units, and search results are sorted by relevance score.
- Introduces
MatchedUnitstruct to wrap units with their fuzzy match indices for highlighting - Replaces simple substring matching with fuzzy matching using the
fuzzy-matchercrate (SkimMatcherV2) - Updates the UI rendering to highlight matched characters in the service list
Reviewed changes
Copilot reviewed 2 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/components/home.rs | Adds MatchedUnit struct, updates filtered_units to use it, implements fuzzy matching in refresh_filtered_units(), adds highlighting logic in the render method, and updates all references to access .unit field |
| Cargo.toml | Adds fuzzy-matcher = "0.3" dependency |
| Cargo.lock | Adds lock file entries for fuzzy-matcher and its dependency thread_local |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| let mut last_end = 0; | ||
|
|
||
| for &idx in &m.match_indices { | ||
| if idx > last_end && idx <= name.len() { |
There was a problem hiding this comment.
The condition idx <= name.len() should be idx < name.len(). When idx == name.len(), we're at the end of the string and shouldn't be processing a match at that position. This could lead to incorrect highlighting if the fuzzy matcher returns an out-of-bounds index.
| if idx > last_end && idx <= name.len() { | |
| if idx > last_end && idx < name.len() { |
Improving the find/search functionality.