higher score for case-senstive match

This commit is contained in:
Johannes Rieken
2017-03-20 10:21:03 +01:00
parent 205a2555ad
commit 6dc76d59e5
2 changed files with 5 additions and 5 deletions
+3 -3
View File
@@ -672,21 +672,21 @@ export function _matchRecursive(
&& ((value = _matchRecursive(pattern, lowPattern, upPattern, patternPos + 1, word, lowWord, wordPos + 1, matches)) >= 0)
) {
matches.unshift(wordPos);
return (pattern.charAt(patternPos) === word.charAt(wordPos) ? 11 : 9) + value;
return (pattern.charAt(patternPos) === word.charAt(wordPos) ? 17 : 11) + value;
}
if ((idx = lowWord.indexOf(`_${lowPatternChar}`, wordPos)) >= 0
&& ((value = _matchRecursive(pattern, lowPattern, upPattern, patternPos + 1, word, lowWord, idx + 2, matches)) >= 0)
) {
matches.unshift(idx + 1);
return (pattern.charAt(patternPos) === word.charAt(idx + 1) ? 11 : 9) + value;
return (pattern.charAt(patternPos) === word.charAt(idx + 1) ? 17 : 11) + value;
}
if ((idx = word.indexOf(upPattern.charAt(patternPos), wordPos)) >= 0
&& ((value = _matchRecursive(pattern, lowPattern, upPattern, patternPos + 1, word, lowWord, idx + 1, matches)) >= 0)
) {
matches.unshift(idx);
return (pattern.charAt(patternPos) === word.charAt(idx) ? 11 : 9) + value;
return (pattern.charAt(patternPos) === word.charAt(idx) ? 17 : 11) + value;
}
if (patternPos > 0
+2 -2
View File
@@ -259,8 +259,8 @@ suite('Filters', () => {
assertTopScore('CC', 1, 'camelCase', 'CamelCase');
assertTopScore('cC', 0, 'camelCase', 'CamelCase');
// assertTopScore('cC', 1, 'ccfoo', 'camelCase');
// assertTopScore('cC', 1, 'ccfoo', 'camelCase', 'foo-cC-bar');
assertTopScore('cC', 1, 'ccfoo', 'camelCase');
assertTopScore('cC', 1, 'ccfoo', 'camelCase', 'foo-cC-bar');
// issue #17836
assertTopScore('p', 0, 'parse', 'posix', 'pafdsa', 'path', 'p');