diff --git a/src/algo/algo.go b/src/algo/algo.go index c0022475..d6a9a663 100644 --- a/src/algo/algo.go +++ b/src/algo/algo.go @@ -767,6 +767,9 @@ func FuzzyMatchV1(caseSensitive bool, normalize bool, forward bool, text *util.C char = unicode.To(unicode.LowerCase, char) } } + if normalize { + char = normalizeRune(char) + } pidx_ := indexAt(pidx, lenPattern, forward) pchar := pattern[pidx_] diff --git a/src/algo/algo_test.go b/src/algo/algo_test.go index b5ed0e77..aab03b0a 100644 --- a/src/algo/algo_test.go +++ b/src/algo/algo_test.go @@ -200,3 +200,12 @@ func TestLongString(t *testing.T) { bytes[math.MaxUint16] = 'z' assertMatch(t, FuzzyMatchV2, true, true, string(bytes), "zx", math.MaxUint16, math.MaxUint16+2, scoreMatch*2+bonusConsecutive) } + +func TestLongStringWithNormalize(t *testing.T) { + bytes := make([]byte, 30000) + for i := range bytes { + bytes[i] = 'x' + } + unicodeString := string(bytes) + " MinĂ­mal example" + assertMatch2(t, FuzzyMatchV1, false, true, false, unicodeString, "minim", 30001, 30006, 140) +}