Skip to content
Myr

Use exact match by default for inverse search term

Before adoption: this commit came in with the history the project adopted, so no landing records it.

This is a breaking change, but I believe it makes much more sense. It is almost impossible to predict which entries will be filtered out due to a fuzzy inverse term. You can still perform inverse-fuzzy-match by prepending `!'` to the term. | Token | Match type | Description | | -------- | -------------------------- | --------------------------------- | | `sbtrkt` | fuzzy-match | Items that match `sbtrkt` | | `^music` | prefix-exact-match | Items that start with `music` | | `.mp3$` | suffix-exact-match | Items that end with `.mp3` | | `'wild` | exact-match (quoted) | Items that include `wild` | | `!fire` | inverse-exact-match | Items that do not include `fire` | | `!.mp3$` | inverse-suffix-exact-match | Items that do not end with `.mp3` |

authored by Junegunn Choi · committed by Junegunn Choi · parent 154cf22 · Browse files · 2 files+5 added−4 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

2 files+5 added−4 removed

  • other:+5 added−4 removed

2 files+5 added−4 removed

modified:src/pattern_test.go+3 added-3 removed
20 unmodified lines
21 terms[0][0].typ != termFuzzy || terms[0][0].inv ||22 terms[1][0].typ != termExact || terms[1][0].inv ||23 terms[2][0].typ != termPrefix || terms[2][0].inv ||24 terms[3][0].typ != termSuffix || terms[3][0].inv ||25 terms[4][0].typ != termFuzzy || !terms[4][0].inv ||26 terms[5][0].typ != termExact || !terms[5][0].inv ||25 terms[4][0].typ != termExact || !terms[4][0].inv ||26 terms[5][0].typ != termFuzzy || !terms[5][0].inv ||27 terms[6][0].typ != termPrefix || !terms[6][0].inv ||28 terms[7][0].typ != termSuffix || !terms[7][0].inv ||29 terms[7][1].typ != termEqual || terms[7][1].inv ||30 terms[8][0].typ != termPrefix || terms[8][0].inv ||31 terms[8][1].typ != termExact || terms[8][1].inv ||32 terms[8][2].typ != termSuffix || terms[8][2].inv ||33 terms[8][3].typ != termFuzzy || !terms[8][3].inv {33 terms[8][3].typ != termExact || !terms[8][3].inv {34 t.Errorf("%s", terms)35 }36 for idx, termSet := range terms[:8] {37 term := termSet[0]
151 unmodified lines
modified:src/pattern.go+2 added-1 removed
161 unmodified lines
162 }163164 if strings.HasPrefix(text, "!") {165 inv = true166 typ = termExact167 text = text[1:]168 }169170 if strings.HasPrefix(text, "'") {171 // Flip exactness171 if fuzzy {172 if fuzzy && !inv {173 typ = termExact174 text = text[1:]175 } else {176 typ = termFuzzy
219 unmodified lines