1
0
mirror of https://github.com/taigrr/wtf synced 2025-01-18 04:03:14 -08:00

Fix keyboard fallthrough

We are expecting Esc and Tab to perform other actions, so these need to not return nil
Addresses #520
This commit is contained in:
Sean Smith 2019-08-03 22:23:50 -04:00
parent a1aafbeade
commit 10772c2190

View File

@ -38,6 +38,7 @@ func NewWtfApp(app *tview.Application, config *config.Config, configFilePath str
pages: tview.NewPages(),
}
wtfApp.app.SetInputCapture(wtfApp.keyboardIntercept)
wtfApp.widgets = maker.MakeWidgets(wtfApp.app, wtfApp.pages, wtfApp.config)
wtfApp.display = NewDisplay(wtfApp.widgets, wtfApp.config)
wtfApp.focusTracker = NewFocusTracker(wtfApp.app, wtfApp.widgets, wtfApp.config)
@ -45,7 +46,6 @@ func NewWtfApp(app *tview.Application, config *config.Config, configFilePath str
wtfApp.pages.AddPage("grid", wtfApp.display.Grid, true, true)
wtfApp.app.SetRoot(wtfApp.pages, true)
wtfApp.app.SetInputCapture(wtfApp.keyboardIntercept)
wtfApp.validator.Validate(wtfApp.widgets)
@ -86,13 +86,11 @@ func (wtfApp *WtfApp) keyboardIntercept(event *tcell.EventKey) *tcell.EventKey {
return nil
case tcell.KeyTab:
wtfApp.focusTracker.Next()
return nil
case tcell.KeyBacktab:
wtfApp.focusTracker.Prev()
return nil
case tcell.KeyEsc:
wtfApp.focusTracker.None()
return nil
}
// Checks to see if any widget has been assigned the pressed key as its focus key