parent
34cc749965
commit
258a8768c2
|
@ -7,7 +7,7 @@ Desktop application launcher
|
|||
|
||||
## Download
|
||||
|
||||
[**Download gmenu**](https://gmenu.rocketnine.space/download/) (Linux binaries are available)
|
||||
[**Download gmenu**](https://gmenu.rocketnine.space/download/?sort=name&order=desc) (Linux binaries are available)
|
||||
|
||||
## Compile
|
||||
|
||||
|
|
|
@ -20,6 +20,7 @@ var (
|
|||
|
||||
inputBuffer = make(chan string, 3)
|
||||
input string
|
||||
inputLower string
|
||||
inputFlushed = make(chan bool)
|
||||
)
|
||||
|
||||
|
@ -56,6 +57,8 @@ inputLoop:
|
|||
}
|
||||
|
||||
input = in
|
||||
inputLower = strings.ToLower(in)
|
||||
|
||||
u(input)
|
||||
}
|
||||
}
|
||||
|
@ -85,12 +88,11 @@ func MatchEntry(i int) bool {
|
|||
return true
|
||||
}
|
||||
|
||||
b := strings.ToLower(input)
|
||||
if b == "" {
|
||||
if inputLower == "" {
|
||||
return true
|
||||
}
|
||||
|
||||
return fuzzy.MatchFold(b, Names[i])
|
||||
return fuzzy.MatchFold(inputLower, Names[i])
|
||||
}
|
||||
|
||||
func FilterEntries() {
|
||||
|
@ -102,9 +104,7 @@ func FilterEntries() {
|
|||
|
||||
sort.Slice(FilteredEntries, SortEmpty)
|
||||
} else {
|
||||
b := strings.ToLower(input)
|
||||
|
||||
matches := fuzzy.RankFindFold(b, Names)
|
||||
matches := fuzzy.RankFindFold(inputLower, Names)
|
||||
sort.Sort(matches)
|
||||
|
||||
for _, match := range matches {
|
||||
|
@ -194,14 +194,14 @@ func SortFiltered(i, j int) bool {
|
|||
jlower = ""
|
||||
}
|
||||
|
||||
ipre := strings.HasPrefix(ilower, input)
|
||||
jpre := strings.HasPrefix(jlower, input)
|
||||
ipre := strings.HasPrefix(ilower, inputLower)
|
||||
jpre := strings.HasPrefix(jlower, inputLower)
|
||||
|
||||
icon := strings.Contains(ilower, input)
|
||||
jcon := strings.Contains(jlower, input)
|
||||
icon := strings.Contains(ilower, inputLower)
|
||||
jcon := strings.Contains(jlower, inputLower)
|
||||
|
||||
imatch := fuzzy.MatchFold(input, ilower)
|
||||
jmatch := fuzzy.MatchFold(input, jlower)
|
||||
imatch := fuzzy.MatchFold(inputLower, ilower)
|
||||
jmatch := fuzzy.MatchFold(inputLower, jlower)
|
||||
|
||||
if ipre != jpre {
|
||||
return ipre && !jpre
|
||||
|
|
Loading…
Reference in New Issue