Fixed repeation of shortcut keys because of returning event even after executing shortcut

This commit is contained in:
Anis Ahmad
2021-01-15 21:32:09 +06:00
parent 0c09a29550
commit d8677ca6d7
4 changed files with 25 additions and 12 deletions

View File

@@ -89,6 +89,16 @@ func setKeyboardShortcuts() *tview.Application {
return event
}
// Global shortcuts
switch event.Rune() {
case 'p':
app.SetFocus(projectPane)
return nil
case 't':
app.SetFocus(taskPane)
return nil
}
// Handle based on current focus. Handlers may modify event
switch {
case projectPane.HasFocus():
@@ -99,18 +109,6 @@ func setKeyboardShortcuts() *tview.Application {
event = taskDetailPane.handleShortcuts(event)
}
// Global shortcuts
switch event.Rune() {
case 'p':
app.SetFocus(projectPane)
case 't':
app.SetFocus(taskPane)
case 'f':
// @TODO : Remove
// statusBar.showForSeconds(reflect.TypeOf(app.GetFocus()).String(), 5)
statusBar.showForSeconds(fmt.Sprintf("Due: %#v", taskPane.activeTask), 5)
}
return event
})
}