diff --git a/ui.go b/ui.go index f2ab8bd..3b920fc 100644 --- a/ui.go +++ b/ui.go @@ -30,6 +30,10 @@ func (ui *UICycle) Increase() { ui.index = (ui.index + 1) % ui.len } +func (ui *UICycle) Decrease() { + ui.index = ((ui.index-1)%ui.len + ui.len) % ui.len +} + func (ui *UICycle) GetCurrentUI() tview.Primitive { return ui.widget[ui.index] } @@ -407,9 +411,12 @@ func translatePageHandler(event *tcell.EventKey) *tcell.EventKey { func langDropDownHandler(key tcell.Key) { switch key { - case tcell.KeyTAB: + case tcell.KeyTab: langCycle.Increase() app.SetFocus(langCycle.GetCurrentUI()) + case tcell.KeyBacktab: + langCycle.Decrease() + app.SetFocus(langCycle.GetCurrentUI()) case tcell.KeyEsc: mainPage.HidePage("langPage") } @@ -417,9 +424,12 @@ func langDropDownHandler(key tcell.Key) { func styleDropDownHandler(key tcell.Key) { switch key { - case tcell.KeyTAB: + case tcell.KeyTab: styleCycle.Increase() app.SetFocus(styleCycle.GetCurrentUI()) + case tcell.KeyBacktab: + styleCycle.Decrease() + app.SetFocus(styleCycle.GetCurrentUI()) case tcell.KeyEsc: mainPage.HidePage("stylePage") }