Menu & MenuBar experience improvements
This commit is contained in:
20
ui/util.go
20
ui/util.go
@ -1,5 +1,25 @@
|
||||
package ui
|
||||
|
||||
import "unicode"
|
||||
|
||||
// QuickCharInString is used for finding the "quick char" in a string. A quick char
|
||||
// suffixes a '_' (underscore). So basically, this function returns any rune after
|
||||
// an underscore. The rune is always made lowercase. The bool returned is whether
|
||||
// the rune was found.
|
||||
func QuickCharInString(s string) (bool, rune) {
|
||||
runes := []rune(s)
|
||||
for i, r := range runes {
|
||||
if r == '_' {
|
||||
if i+1 < len(runes) {
|
||||
return true, unicode.ToLower(runes[i+1])
|
||||
} else {
|
||||
return false, ' '
|
||||
}
|
||||
}
|
||||
}
|
||||
return false, ' '
|
||||
}
|
||||
|
||||
// Max returns the larger integer.
|
||||
func Max(a, b int) int {
|
||||
if a > b {
|
||||
|
Reference in New Issue
Block a user