From 6bc592e6c95e31fa597c4db8f793a6b14966857f Mon Sep 17 00:00:00 2001 From: Junegunn Choi Date: Sat, 12 Aug 2017 00:28:30 +0900 Subject: [PATCH] Update FuzzyMatchV1 to use skip optimization used in V2 --- src/algo/algo.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/algo/algo.go b/src/algo/algo.go index 7a6dad3..919e31a 100644 --- a/src/algo/algo.go +++ b/src/algo/algo.go @@ -586,6 +586,9 @@ func FuzzyMatchV1(caseSensitive bool, normalize bool, forward bool, text util.Ch if len(pattern) == 0 { return Result{0, 0, 0}, nil } + if asciiFuzzyIndex(&text, pattern, caseSensitive) < 0 { + return Result{-1, -1, 0}, nil + } pidx := 0 sidx := -1