@@ -68,6 +68,8 @@ public MatchResult FuzzyMatch(string query, string stringToCompare, MatchOption
68
68
69
69
// preset acronymScore
70
70
int acronymScore = 100 ;
71
+ int acronymsRemainingNotMatched = 0 ;
72
+ int acronymsMatched = 0 ;
71
73
72
74
var fullStringToCompareWithoutCase = opt . IgnoreCase ? stringToCompare . ToLower ( ) : stringToCompare ;
73
75
var queryWithoutCase = opt . IgnoreCase ? query . ToLower ( ) : query ;
@@ -91,6 +93,15 @@ public MatchResult FuzzyMatch(string query, string stringToCompare, MatchOption
91
93
92
94
for ( var compareStringIndex = 0 ; compareStringIndex < fullStringToCompareWithoutCase . Length ; compareStringIndex ++ )
93
95
{
96
+ if ( currentAcronymQueryIndex >= queryWithoutCase . Length && acronymsMatched > 0 )
97
+ {
98
+ if ( char . IsUpper ( stringToCompare [ compareStringIndex ] ) ||
99
+ char . IsNumber ( stringToCompare [ compareStringIndex ] ) ||
100
+ char . IsWhiteSpace ( stringToCompare [ compareStringIndex ] ) )
101
+ acronymsRemainingNotMatched ++ ;
102
+ continue ;
103
+ }
104
+
94
105
if ( currentAcronymQueryIndex >= queryWithoutCase . Length
95
106
|| allQuerySubstringsMatched && acronymScore < ( int ) UserSettingSearchPrecision )
96
107
break ;
@@ -118,11 +129,13 @@ public MatchResult FuzzyMatch(string query, string stringToCompare, MatchOption
118
129
char . IsDigit ( currentCompareChar ) )
119
130
{
120
131
acronymMatchData . Add ( compareStringIndex ) ;
132
+ acronymsMatched ++ ;
121
133
}
122
134
}
123
135
else if ( ! ( spaceMet = char . IsWhiteSpace ( stringToCompare [ compareStringIndex ] ) ) )
124
136
{
125
137
acronymMatchData . Add ( compareStringIndex ) ;
138
+ acronymsMatched ++ ;
126
139
}
127
140
128
141
currentAcronymQueryIndex ++ ;
0 commit comments