mirror of
https://github.com/Llewellynvdm/fzf.git
synced 2024-11-24 21:57:36 +00:00
Require quotes on both sides for boundary matching even in --exact mode
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.
This commit is contained in:
parent
6a67712944
commit
efbcd5a683
@ -195,13 +195,9 @@ func parseTerms(fuzzy bool, caseMode Case, normalize bool, str string) []termSet
|
||||
text = text[:len(text)-1]
|
||||
}
|
||||
|
||||
if fuzzy && len(text) > 2 && strings.HasPrefix(text, "'") && strings.HasSuffix(text, "'") ||
|
||||
!fuzzy && !strings.HasPrefix(text, "'") && strings.HasSuffix(text, "'") {
|
||||
if len(text) > 2 && strings.HasPrefix(text, "'") && strings.HasSuffix(text, "'") {
|
||||
typ = termExactBoundary
|
||||
if fuzzy {
|
||||
text = text[1:]
|
||||
}
|
||||
text = text[:len(text)-1]
|
||||
text = text[1 : len(text)-1]
|
||||
} else if strings.HasPrefix(text, "'") {
|
||||
// Flip exactness
|
||||
if fuzzy && !inv {
|
||||
|
Loading…
Reference in New Issue
Block a user