Fix keymaps. Backtab
This commit is contained in:
@@ -88,15 +88,30 @@ func (w *LinearLayout) Init(id string, s tcell.Style) {
|
||||
active := w.findActive()
|
||||
if active == nil && len(w.widgets) > 0 {
|
||||
// No widget is active, but we do have some
|
||||
|
||||
if w.widgets[0].Focusable() {
|
||||
w.widgets[0].SetActive(true)
|
||||
return true
|
||||
for i := range w.widgets {
|
||||
if w.widgets[i].Focusable() {
|
||||
w.widgets[i].SetActive(true)
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
return w.ActivateNext()
|
||||
}))
|
||||
w.keyMap.Add(NewKey(BuildEK(tcell.KeyBacktab), func(ev *tcell.EventKey) bool {
|
||||
active := w.findActive()
|
||||
if active == nil && len(w.widgets) > 0 {
|
||||
// No widget is active, but we do have some
|
||||
for i := len(w.widgets) - 1; i >= 0; i-- {
|
||||
if w.widgets[i].Focusable() {
|
||||
w.widgets[i].SetActive(true)
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
return w.ActivatePrev()
|
||||
}))
|
||||
}
|
||||
|
||||
func (w *LinearLayout) Id() string { return w.id }
|
||||
|
||||
Reference in New Issue
Block a user