mirror of
https://github.com/eeeXun/GTT.git
synced 2025-05-19 01:00:20 -07:00
Tab & Backtab to cycle through layout
This commit is contained in:
parent
9e8379d6a5
commit
457d94ed9f
14
ui.go
14
ui.go
@ -30,6 +30,10 @@ func (ui *UICycle) Increase() {
|
|||||||
ui.index = (ui.index + 1) % ui.len
|
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 {
|
func (ui *UICycle) GetCurrentUI() tview.Primitive {
|
||||||
return ui.widget[ui.index]
|
return ui.widget[ui.index]
|
||||||
}
|
}
|
||||||
@ -407,9 +411,12 @@ func translatePageHandler(event *tcell.EventKey) *tcell.EventKey {
|
|||||||
|
|
||||||
func langDropDownHandler(key tcell.Key) {
|
func langDropDownHandler(key tcell.Key) {
|
||||||
switch key {
|
switch key {
|
||||||
case tcell.KeyTAB:
|
case tcell.KeyTab:
|
||||||
langCycle.Increase()
|
langCycle.Increase()
|
||||||
app.SetFocus(langCycle.GetCurrentUI())
|
app.SetFocus(langCycle.GetCurrentUI())
|
||||||
|
case tcell.KeyBacktab:
|
||||||
|
langCycle.Decrease()
|
||||||
|
app.SetFocus(langCycle.GetCurrentUI())
|
||||||
case tcell.KeyEsc:
|
case tcell.KeyEsc:
|
||||||
mainPage.HidePage("langPage")
|
mainPage.HidePage("langPage")
|
||||||
}
|
}
|
||||||
@ -417,9 +424,12 @@ func langDropDownHandler(key tcell.Key) {
|
|||||||
|
|
||||||
func styleDropDownHandler(key tcell.Key) {
|
func styleDropDownHandler(key tcell.Key) {
|
||||||
switch key {
|
switch key {
|
||||||
case tcell.KeyTAB:
|
case tcell.KeyTab:
|
||||||
styleCycle.Increase()
|
styleCycle.Increase()
|
||||||
app.SetFocus(styleCycle.GetCurrentUI())
|
app.SetFocus(styleCycle.GetCurrentUI())
|
||||||
|
case tcell.KeyBacktab:
|
||||||
|
styleCycle.Decrease()
|
||||||
|
app.SetFocus(styleCycle.GetCurrentUI())
|
||||||
case tcell.KeyEsc:
|
case tcell.KeyEsc:
|
||||||
mainPage.HidePage("stylePage")
|
mainPage.HidePage("stylePage")
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user