Default to substring filtering, add option to go back to fuzzy filtering

By default we now search for substrings; you can search for multiple substrings
by separating them with spaces. Add a config option gui.filterMode that can be
set to 'fuzzy' to switch back to the previous behavior.
This commit is contained in:
Stefan Haller 2024-03-10 10:58:19 +01:00
parent a82e26d11e
commit a8797c7261
12 changed files with 164 additions and 52 deletions

View file

@ -86,6 +86,7 @@ gui:
border: 'rounded' # one of 'single' | 'double' | 'rounded' | 'hidden'
animateExplosion: true # shows an explosion animation when nuking the working tree
portraitMode: 'auto' # one of 'auto' | 'never' | 'always'
filterMode: 'substring' # one of 'substring' | 'fuzzy'; see 'Filtering' section below
git:
paging:
colorArg: always
@ -374,6 +375,12 @@ That's the behavior when `gui.scrollOffBehavior` is set to "margin" (the default
This setting applies both to all list views (e.g. commits and branches etc), and to the staging view.
## Filtering
We have two ways to filter things, substring matching (the default) and fuzzy searching. With substring matching, the text you enter gets searched for verbatim (usually case-insensitive, except when your filter string contains uppercase letters, in which case we search case-sensitively). You can search for multiple non-contiguous substrings by separating them with spaces; for example, "int test" will match "integration-testing". All substrings have to match, but not necessarily in the given order.
Fuzzy searching is smarter in that it allows every letter of the filter string to match anywhere in the text (only in order though), assigning a weight to the quality of the match and sorting by that order. This has the advantage that it allows typing "clt" to match "commit_loader_test" (letters at the beginning of subwords get more weight); but it has the disadvantage that it tends to return lots of irrelevant results, especially with short filter strings.
## Color Attributes
For color attributes you can choose an array of attributes (with max one color attribute)