summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJunegunn Choi <junegunn.c@gmail.com>2015-09-12 11:00:30 +0900
committerJunegunn Choi <junegunn.c@gmail.com>2015-09-12 11:00:30 +0900
commit9017e297417bc20c89e1e7c9ce47f1c2fbbfd5fc (patch)
tree85e617ae04e9cf9b7a1551c6da17ee83b090aa90
parent0a22142d88ae6cf65d3c9801978241554c3ee968 (diff)
Make it possible to unquote the term in extended-exact mode
Close #338
-rw-r--r--README.md3
-rw-r--r--src/pattern.go3
-rw-r--r--src/pattern_test.go4
3 files changed, 7 insertions, 3 deletions
diff --git a/README.md b/README.md
index 2bbdff7c..6ec5fbcd 100644
--- a/README.md
+++ b/README.md
@@ -125,7 +125,8 @@ such as: `^music .mp3$ sbtrkt !rmx`
| `!'fire` | Items that do not include `fire` | inverse-exact-match |
If you don't need fuzzy matching and do not wish to "quote" every word, start
-fzf with `-e` or `--extended-exact` option.
+fzf with `-e` or `--extended-exact` option. Note that in `--extended-exact`
+mode, `'`-prefix "unquotes" the term.
#### Environment variables
diff --git a/src/pattern.go b/src/pattern.go
index f83861ee..cfeb68dc 100644
--- a/src/pattern.go
+++ b/src/pattern.go
@@ -151,6 +151,9 @@ func parseTerms(mode Mode, caseMode Case, str string) []term {
if mode == ModeExtended {
typ = termExact
text = text[1:]
+ } else if mode == ModeExtendedExact {
+ typ = termFuzzy
+ text = text[1:]
}
} else if strings.HasPrefix(text, "^") {
if strings.HasSuffix(text, "$") {
diff --git a/src/pattern_test.go b/src/pattern_test.go
index c7f54142..66f5d41d 100644
--- a/src/pattern_test.go
+++ b/src/pattern_test.go
@@ -37,11 +37,11 @@ func TestParseTermsExtendedExact(t *testing.T) {
"aaa 'bbb ^ccc ddd$ !eee !'fff !^ggg !hhh$")
if len(terms) != 8 ||
terms[0].typ != termExact || terms[0].inv || len(terms[0].text) != 3 ||
- terms[1].typ != termExact || terms[1].inv || len(terms[1].text) != 4 ||
+ terms[1].typ != termFuzzy || terms[1].inv || len(terms[1].text) != 3 ||
terms[2].typ != termPrefix || terms[2].inv || len(terms[2].text) != 3 ||
terms[3].typ != termSuffix || terms[3].inv || len(terms[3].text) != 3 ||
terms[4].typ != termExact || !terms[4].inv || len(terms[4].text) != 3 ||
- terms[5].typ != termExact || !terms[5].inv || len(terms[5].text) != 4 ||
+ terms[5].typ != termFuzzy || !terms[5].inv || len(terms[5].text) != 3 ||
terms[6].typ != termPrefix || !terms[6].inv || len(terms[6].text) != 3 ||
terms[7].typ != termSuffix || !terms[7].inv || len(terms[7].text) != 3 {
t.Errorf("%s", terms)