diff options
| author | Junegunn Choi <junegunn.c@gmail.com> | 2015-01-09 02:35:20 +0900 |
|---|---|---|
| committer | Junegunn Choi <junegunn.c@gmail.com> | 2015-01-09 02:35:20 +0900 |
| commit | d303c5b3ebc6d56af6d3a03c6b4cdb361a2b022c (patch) | |
| tree | e8963b7f3fb3d16fae7befe45095c2d86d6ca9ed /src | |
| parent | f401c42f9c22de9df7a40ee31727ff0eab5dd30e (diff) | |
| download | fzf-d303c5b3ebc6d56af6d3a03c6b4cdb361a2b022c.tar.gz | |
Minor refactoring
Diffstat (limited to 'src')
| -rw-r--r-- | src/algo.go | 2 | ||||
| -rw-r--r-- | src/tokenizer.go | 3 |
2 files changed, 2 insertions, 3 deletions
diff --git a/src/algo.go b/src/algo.go index 16790ba9..e0c173f2 100644 --- a/src/algo.go +++ b/src/algo.go @@ -90,7 +90,7 @@ func ExactMatchNaive(caseSensitive bool, input *string, pattern []rune) (int, in runes := []rune(*input) numRunes := len(runes) plen := len(pattern) - if len(runes) < plen { + if numRunes < plen { return -1, -1 } diff --git a/src/tokenizer.go b/src/tokenizer.go index bc1ca3a4..d62f395d 100644 --- a/src/tokenizer.go +++ b/src/tokenizer.go @@ -118,14 +118,13 @@ func awkTokenizer(input *string) ([]string, int) { } func Tokenize(str *string, delimiter *regexp.Regexp) []Token { - prefixLength := 0 if delimiter == nil { // AWK-style (\S+\s*) tokens, prefixLength := awkTokenizer(str) return withPrefixLengths(tokens, prefixLength) } else { tokens := delimiter.FindAllString(*str, -1) - return withPrefixLengths(tokens, prefixLength) + return withPrefixLengths(tokens, 0) } } |
