Minor refactorings

This commit is contained in:
Junegunn Choi
2017-08-26 03:24:42 +09:00
parent 329de8f416
commit af809c9661
4 changed files with 4 additions and 4 deletions

View File

@@ -147,7 +147,7 @@ func Tokenize(text string, delimiter Delimiter) []Token {
if delimiter.regex != nil {
for len(text) > 0 {
loc := delimiter.regex.FindStringIndex(text)
if loc == nil {
if len(loc) < 2 {
loc = []int{0, len(text)}
}
last := util.Max(loc[1], 1)