From f087c8260a71bb1f5e8e4572a6f909a4595bf5e7 Mon Sep 17 00:00:00 2001 From: Christian Rocha Date: Mon, 17 Feb 2020 16:31:28 -0500 Subject: [PATCH] Use up/down to go between fields too --- examples/inputs/main.go | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/examples/inputs/main.go b/examples/inputs/main.go index f8adad1..a9c0d09 100644 --- a/examples/inputs/main.go +++ b/examples/inputs/main.go @@ -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 {