Treat $ as proper search query

When $ is the leading character in a query, it's probably not meant to
be an anchor.
This commit is contained in:
Junegunn Choi 2017-08-10 23:59:40 +09:00
parent e55e029ae8
commit 02a7b96f33
No known key found for this signature in database
GPG Key ID: 254BC280FEF9C627
2 changed files with 2 additions and 2 deletions

View File

@ -175,7 +175,7 @@ func parseTerms(fuzzy bool, caseMode Case, normalize bool, str string) []termSet
text = text[1:]
}
if strings.HasSuffix(text, "$") {
if text != "$" && strings.HasSuffix(text, "$") {
if strings.HasSuffix(text, "\\$") {
text = text[:len(text)-2] + "$"
} else {

View File

@ -58,7 +58,7 @@ func TestParseTermsExtendedExact(t *testing.T) {
}
func TestParseTermsEmpty(t *testing.T) {
terms := parseTerms(true, CaseSmart, false, "' $ ^ !' !^ !$")
terms := parseTerms(true, CaseSmart, false, "' ^ !' !^")
if len(terms) != 0 {
t.Errorf("%s", terms)
}