Repository navigation
Conversation
The fuzzy filter accepts any clip that spells the query out of scattered letters, so long clips match almost anything and, kept in history order, bury the clip that holds the query verbatim. Rank matches instead: a contiguous run sorts above a scattered subsequence, and a new query puts the cursor on its best match so Enter pastes it.
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.
What does this PR do?
Searching for a clip by its exact text could bury it. The fuzzy filter accepts any clip whose text contains the query's characters in order, so a long clip (logs, code, rich text) spells almost any query out of scattered letters — and since results keep the history order, those clips sit above the one that holds the query verbatim.
Seen on a real 70-clip history:
123Soleilmatched 9 clips. The only one containing it verbatim came 7th, below six clips of 700–2200 characters — off-screen, with the cursor on an unrelated clip. Typing123Soleil!found it alone.Matches are now ranked rather than just accepted:
match_quality()(replacesfuzzy_matches()) returnsSubstring,SubsequenceorNone, ordered best first.ClipCardcarries its rank and the list sorts on it before pinned/newest. With no query every card ranks alike, so the history order is unchanged.Fuzzy matching is kept:
spngstill findsscreenshot.png.Type of change
Checklist
-Werror).ctest --preset debugpasses.cmake --build --preset asan && ctest --preset asan(zero leaks, zero UB).clang-formatandclang-tidyare clean.core/ships with tests. (Nocore/change;FuzzyTestcovers the new ranking.)Notes for reviewers
search-changednow goes throughsync_search_from_entry(), so the debounced signal and the pre-paste/arrow flush share one path; its equality check makes a latesearch-changeda no-op.