mirror of
https://github.com/junegunn/fzf.git
synced 2025-08-01 20:52:06 -07:00
Fix Unicode case handling (#186)
This commit is contained in:
@@ -4,12 +4,11 @@ import (
|
||||
"regexp"
|
||||
"sort"
|
||||
"strings"
|
||||
"unicode"
|
||||
|
||||
"github.com/junegunn/fzf/src/algo"
|
||||
)
|
||||
|
||||
const uppercaseLetters = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
|
||||
|
||||
// fuzzy
|
||||
// 'exact
|
||||
// ^exact-prefix
|
||||
@@ -91,7 +90,14 @@ func BuildPattern(mode Mode, caseMode Case,
|
||||
|
||||
switch caseMode {
|
||||
case CaseSmart:
|
||||
if !strings.ContainsAny(asString, uppercaseLetters) {
|
||||
hasUppercase := false
|
||||
for _, r := range runes {
|
||||
if unicode.IsUpper(r) {
|
||||
hasUppercase = true
|
||||
break
|
||||
}
|
||||
}
|
||||
if !hasUppercase {
|
||||
runes, caseSensitive = []rune(strings.ToLower(asString)), false
|
||||
}
|
||||
case CaseIgnore:
|
||||
|
Reference in New Issue
Block a user