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.
With a query active, each card paints where it matches: every verbatim occurrence, or the scattered characters of a subsequence match. Users see at a glance why a clip came up, and long clips no longer hide the hit somewhere in their text. match_mask() computes the hit bytes headless, next to match_quality(); the card folds case per code point and maps hits back onto the shown text, so a highlight never splits a character.
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?
Builds on #14 — please merge that one first; this branch contains its commit.
With a search active, a card now shows where it matches: the hit is painted bold on a translucent yellow, like a find-in-page match. Long clips no longer leave you guessing which part of their text answered the query, and a subsequence match shows the scattered letters that made it.
match_mask()(next tomatch_quality(), headless) returns the bytes to highlight: every verbatim occurrence of the query, else the in-order characters of the subsequence match.match_quality()now shares its subsequence scan.ClipCard::set_query()applies the highlight to the shown text (collapsed preview or expanded clip) as Pango attributes. Case is folded per code point and hits are mapped back onto the original bytes, so a highlight never splits a character, even where lowercasing changes a character's byte length.MainWindow::apply_filter()passes the query to each card; clearing the search clears the highlight.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;FuzzyTestcoversmatch_mask().)Notes for reviewers
#f6d32d) at 40 % alpha, readable on both light and dark themes.make_valid_utf8()like the preview already did, so the label never receives invalid UTF-8.ß↔SS) are not highlighted; filtering is unaffected since it folds whole strings.readability-trailing-commastyle CI's 18.1.8 does not have.