refactor: consistently handle key events

This commit is contained in:
rigormorrtiss 2021-08-31 17:47:30 +04:00
parent effe882849
commit 9f79852e47

View file

@ -76,13 +76,15 @@ func main() {
}
func onAppInputCapture(e *tcell.EventKey) *tcell.EventKey {
switch e.Name() {
case "Alt+Rune[1]":
app.SetFocus(guildsTreeView)
case "Alt+Rune[2]":
app.SetFocus(messagesTextView)
case "Alt+Rune[3]":
app.SetFocus(messageInputField)
if e.Modifiers() == tcell.ModAlt {
switch e.Rune() {
case '1':
app.SetFocus(guildsTreeView)
case '2':
app.SetFocus(messagesTextView)
case '3':
app.SetFocus(messageInputField)
}
}
return e