Use up/down to go between fields too

This commit is contained in:
Christian Rocha 2020-02-17 16:31:28 -05:00
parent 943ebe42d2
commit f087c8260a
No known key found for this signature in database
GPG Key ID: D6CC7A16E5878018

View File

@ -52,13 +52,21 @@ func update(msg tea.Msg, model tea.Model) (tea.Model, tea.Cmd) {
case "tab":
fallthrough
case "enter":
fallthrough
case "up":
fallthrough
case "down":
inputs := []input.Model{
m.nameInput,
m.emailInput,
}
m.index++
if msg.String() == "up" {
m.index--
} else {
m.index++
}
if m.index > len(inputs)-1 {
m.index = 0
} else if m.index < 0 {