Skip to content

Commit

Permalink
Fix missing bonus score on a delimiter character
Browse files Browse the repository at this point in the history
Fix #3645
  • Loading branch information
junegunn committed Feb 22, 2024
1 parent edee2b7 commit 99a7beb
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions src/algo/algo.go
Original file line number Diff line number Diff line change
Expand Up @@ -255,24 +255,29 @@ func charClassOf(char rune) charClass {

func bonusFor(prevClass charClass, class charClass) int16 {
if class > charNonWord {
if prevClass == charWhite {
switch prevClass {
case charWhite:
// Word boundary after whitespace
return bonusBoundaryWhite
} else if prevClass == charDelimiter {
case charDelimiter:
// Word boundary after a delimiter character
return bonusBoundaryDelimiter
} else if prevClass == charNonWord {
case charNonWord:
// Word boundary
return bonusBoundary
}
}

if prevClass == charLower && class == charUpper ||
prevClass != charNumber && class == charNumber {
// camelCase letter123
return bonusCamel123
} else if class == charNonWord {
}

switch class {
case charNonWord, charDelimiter:
return bonusNonWord
} else if class == charWhite {
case charWhite:
return bonusBoundaryWhite
}
return 0
Expand Down

0 comments on commit 99a7beb

Please sign in to comment.