mirror of
https://github.com/junegunn/fzf.git
synced 2025-08-06 15:12:05 -07:00
Disallow escaping of meta characters except for spaces
https://github.com/junegunn/fzf/issues/444#issuecomment-321719604
This commit is contained in:
@@ -54,15 +54,13 @@ type Pattern struct {
|
||||
}
|
||||
|
||||
var (
|
||||
_patternCache map[string]*Pattern
|
||||
_splitRegex *regexp.Regexp
|
||||
_escapedPrefixRegex *regexp.Regexp
|
||||
_cache ChunkCache
|
||||
_patternCache map[string]*Pattern
|
||||
_splitRegex *regexp.Regexp
|
||||
_cache ChunkCache
|
||||
)
|
||||
|
||||
func init() {
|
||||
_splitRegex = regexp.MustCompile(" +")
|
||||
_escapedPrefixRegex = regexp.MustCompile("^\\\\['!^|]")
|
||||
clearPatternCache()
|
||||
clearChunkCache()
|
||||
}
|
||||
@@ -179,17 +177,11 @@ func parseTerms(fuzzy bool, caseMode Case, normalize bool, str string) []termSet
|
||||
}
|
||||
|
||||
if text != "$" && strings.HasSuffix(text, "$") {
|
||||
if strings.HasSuffix(text, "\\$") {
|
||||
text = text[:len(text)-2] + "$"
|
||||
} else {
|
||||
typ = termSuffix
|
||||
text = text[:len(text)-1]
|
||||
}
|
||||
typ = termSuffix
|
||||
text = text[:len(text)-1]
|
||||
}
|
||||
|
||||
if _escapedPrefixRegex.MatchString(text) {
|
||||
text = text[1:]
|
||||
} else if strings.HasPrefix(text, "'") {
|
||||
if strings.HasPrefix(text, "'") {
|
||||
// Flip exactness
|
||||
if fuzzy && !inv {
|
||||
typ = termExact
|
||||
|
Reference in New Issue
Block a user