Skip to content

Commit

Permalink
Fix keyboard fallthrough
Browse files Browse the repository at this point in the history
We are expecting Esc and Tab to perform other actions, so these need to not return nil
Addresses wtfutil#520
  • Loading branch information
Seanstoppable committed Aug 4, 2019
1 parent a1aafbe commit 10772c2
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions app/wtf_app.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,14 @@ 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)
wtfApp.validator = NewModuleValidator()

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)

Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 10772c2

Please sign in to comment.