Skip to content
Myr

Require quotes on both sides for boundary matching even in --exact mode

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

Only requiring '-suffix in --exact mode is confusing and not straightforward. Requiring '-prefix in --exact mode means that the users can experience unintended mode switches while typing. e.g. 'it -> fuzzy (many results) 'it' -> boundary (few results) 'it's -> fuzzy (many results) However, user who intends to input a boundary query should not be interested in the intermediate results, and the number of matches decreases as she types, so it should be okay. On the other hand, user who does intend to type "it's" will be surprised by the sudden decrease of the match count, but eventually get the right result.

authored by Junegunn Choi · committed by Junegunn Choi · parent 6a67712 · Browse files · 1 file+2 added−6 removed
This commit

State

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

Diff stats

1 file+2 added−6 removed

  • other:+2 added−6 removed

1 file+2 added−6 removed

modified:src/pattern.go+2 added-6 removed
193 unmodified lines
194 typ = termSuffix195 text = text[:len(text)-1]196 }197198 if fuzzy && len(text) > 2 && strings.HasPrefix(text, "'") && strings.HasSuffix(text, "'") ||199 !fuzzy && !strings.HasPrefix(text, "'") && strings.HasSuffix(text, "'") {198 if len(text) > 2 && strings.HasPrefix(text, "'") && strings.HasSuffix(text, "'") {199 typ = termExactBoundary201 if fuzzy {202 text = text[1:]203 }204 text = text[:len(text)-1]200 text = text[1 : len(text)-1]201 } else if strings.HasPrefix(text, "'") {202 // Flip exactness203 if fuzzy && !inv {204 typ = termExact
215 unmodified lines