diff options
author | Junegunn Choi <junegunn.c@gmail.com> | 2017-08-18 05:30:13 +0900 |
---|---|---|
committer | Junegunn Choi <junegunn.c@gmail.com> | 2017-08-18 05:30:13 +0900 |
commit | 6977cf268f253f9f0b826b80ade5ced665436cfd (patch) | |
tree | 888db7aeb749cbf5cd455123fb4da748c0dc29dc | |
parent | 931c78a70c3ff39f417898c1e97d21a82b47ec8d (diff) |
Limit search scope of uppercase letter
-rw-r--r-- | src/algo/algo.go | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/algo/algo.go b/src/algo/algo.go index 919e31a4..e98ff1d8 100644 --- a/src/algo/algo.go +++ b/src/algo/algo.go @@ -263,8 +263,11 @@ func trySkip(input *util.Chars, caseSensitive bool, b byte, from int) int { // We may need to search for the uppercase letter again. We don't have to // consider normalization as we can be sure that this is an ASCII string. if !caseSensitive && b >= 'a' && b <= 'z' { + if idx > 0 { + byteArray = byteArray[:idx] + } uidx := bytes.IndexByte(byteArray, b-32) - if idx < 0 || uidx >= 0 && uidx < idx { + if uidx >= 0 { idx = uidx } } |