feat: fzf when adding widgets#293
Merged
sirmalloc merged 3 commits intosirmalloc:mainfrom Apr 8, 2026
Merged
Conversation
Adds fuzzy matching to the widget picker as a fallback when the query has no exact substring match anywhere. Characters must appear in order but need not be adjacent; matches are scored by span, consecutive runs, and word boundaries, and ranked below all exact matches. Selection now resets to the top-ranked result on every keystroke instead of staying pinned to the previously-selected widget type. Matched characters are highlighted in the picker list: yellow-bold for unselected rows, green-bold for the selected row. --------- Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Give display-name initialism matches their own ranking path so abbreviation searches like tw, tc, ti, and to select the intended widget instead of description or type fallbacks. Keep picker highlighting aligned with the ranking logic and add regressions for the reported fuzzy-match cases.
Owner
|
Thanks for this, will publish soon when the next release is ready. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Changes
src/utils/widgets.tscomputeFuzzyScore()with span/consecutive/boundary scoring; add fuzzy tiers tofilterWidgetCatalog()fallback; exportgetMatchSegments()for highlight renderingsrc/tui/components/items-editor/input-handlers.tsselectedTypetonullon every typing/backspace keystroke sonormalizePickerStatealways selects the best matchsrc/tui/components/ItemsEditor.tsxgetMatchSegmentsand render highlighted segments in both the top-level search and widget-level picker listssrc/utils/__tests__/widgets.test.tsgetMatchSegmentscasessrc/tui/components/items-editor/__tests__/input-handlers.test.tsDesign decisions
spaces,
-, and_as boundaries)getMatchSegmentsmirrors the same exact-then-fuzzy priority so highlighted characters always agree with why an entry was ranked where it wasTest plan
bun test)bun run lint)gbin the picker surfaces Git Branch as the top fuzzy match withGandBhighlightedvimwith an existing Version widget selected jumps the cursor to Vim Mode, not Version