mirror of
https://github.com/taigrr/wtf
synced 2025-01-18 04:03:14 -08:00
Merge branch 'master' into patch-1
This commit is contained in:
commit
aa5389c820
@ -29,9 +29,25 @@ func (tracker *FocusTracker) AssignHotKeys() {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
usedKeys := make(map[string]bool)
|
||||||
|
focusables := tracker.focusables()
|
||||||
i := 1
|
i := 1
|
||||||
|
|
||||||
for _, focusable := range tracker.focusables() {
|
for _, focusable := range focusables {
|
||||||
|
if focusable.FocusChar() != "" {
|
||||||
|
usedKeys[focusable.FocusChar()] = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for _, focusable := range focusables {
|
||||||
|
if focusable.FocusChar() != "" {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
if _, foundKey := usedKeys[string('0'+i)]; foundKey {
|
||||||
|
for ; foundKey; _, foundKey = usedKeys[string('0'+i)] {
|
||||||
|
i++
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Don't have nav characters > "9"
|
// Don't have nav characters > "9"
|
||||||
if i >= 10 {
|
if i >= 10 {
|
||||||
break
|
break
|
||||||
|
@ -22,10 +22,16 @@ type TextWidget struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func NewTextWidget(app *tview.Application, name string, configKey string, focusable bool) TextWidget {
|
func NewTextWidget(app *tview.Application, name string, configKey string, focusable bool) TextWidget {
|
||||||
|
focusCharValue := Config.UInt(fmt.Sprintf("wtf.mods.%s.focusChar", configKey), -1)
|
||||||
|
focusChar := string('0' + focusCharValue)
|
||||||
|
if focusCharValue == -1 {
|
||||||
|
focusChar = ""
|
||||||
|
}
|
||||||
|
|
||||||
widget := TextWidget{
|
widget := TextWidget{
|
||||||
enabled: Config.UBool(fmt.Sprintf("wtf.mods.%s.enabled", configKey), false),
|
enabled: Config.UBool(fmt.Sprintf("wtf.mods.%s.enabled", configKey), false),
|
||||||
focusable: focusable,
|
focusable: focusable,
|
||||||
|
focusChar: focusChar,
|
||||||
Name: Config.UString(fmt.Sprintf("wtf.mods.%s.title", configKey), name),
|
Name: Config.UString(fmt.Sprintf("wtf.mods.%s.title", configKey), name),
|
||||||
RefreshInt: Config.UInt(fmt.Sprintf("wtf.mods.%s.refreshInterval", configKey)),
|
RefreshInt: Config.UInt(fmt.Sprintf("wtf.mods.%s.refreshInterval", configKey)),
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user