Fix missing bonus score on a delimiter character

Fix #3645
This commit is contained in:
Junegunn Choi 2024-02-22 23:19:11 +09:00
parent edee2b753c
commit 99a7beba57
No known key found for this signature in database
GPG Key ID: 254BC280FEF9C627

View File

@ -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