From a09e411936244aa515519134dbbd938ae3cadcd4 Mon Sep 17 00:00:00 2001 From: Junegunn Choi Date: Fri, 11 Aug 2017 00:07:18 +0900 Subject: Treat | as proper query when it can't be an OR operator --- src/pattern.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/pattern.go') diff --git a/src/pattern.go b/src/pattern.go index 8029fd0c..dbb3983f 100644 --- a/src/pattern.go +++ b/src/pattern.go @@ -152,6 +152,7 @@ func parseTerms(fuzzy bool, caseMode Case, normalize bool, str string) []termSet sets := []termSet{} set := termSet{} switchSet := false + afterBar := false for _, token := range tokens { typ, inv, text := termFuzzy, false, strings.Replace(token, "\t", " ", -1) lowerText := strings.ToLower(text) @@ -164,10 +165,12 @@ func parseTerms(fuzzy bool, caseMode Case, normalize bool, str string) []termSet typ = termExact } - if text == "|" { + if len(set) > 0 && !afterBar && text == "|" { switchSet = false + afterBar = true continue } + afterBar = false if strings.HasPrefix(text, "!") { inv = true -- cgit v1.2.3