Skip to content

Commit

Permalink
Reset tolerance for each file path search
Browse files Browse the repository at this point in the history
  • Loading branch information
Mitja Leino committed Apr 27, 2024
1 parent b172130 commit 510dbfc
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ class ScoreCalculator(searchString: String) {
filenameIndex = currentFilePath.lastIndexOf("/") + 1
longestStreak = 0
fuzzyScore = FuzzyScore()
toleranceCount = 0

// Check if the search string is longer than the file path, which results in no match
if (lowerSearchString.length > (currentFilePath.length + tolerance)) {
Expand All @@ -58,7 +59,7 @@ class ScoreCalculator(searchString: String) {
}

if (multiMatch) {
calculateMultiMatchScore()
calculateMultiMatchScore()
}
calculateFilenameScore()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ class ScoreCalculatorTest {
}

@Test
fun `qewji`() {
fun `Don't match longer strings even if there is tolerance left`() {
val sc = ScoreCalculator("kotlin12345")
sc.setTolerance(5)

Expand Down

0 comments on commit 510dbfc

Please sign in to comment.