diff options
Diffstat (limited to 'menu/input.go')
| -rw-r--r-- | menu/input.go | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/menu/input.go b/menu/input.go index 6d05749..cd07543 100644 --- a/menu/input.go +++ b/menu/input.go @@ -5,6 +5,16 @@ import tea "github.com/charmbracelet/bubbletea" func (m *Model) HandleInput(msg tea.KeyMsg) (tea.Cmd, error) { var cmd tea.Cmd switch msg.String() { + case "i", "I": + if m.Alt { + m.Alt = false + m.AutoAlt = false + return tea.ExitAltScreen, nil + } else { + m.Alt = true + m.AutoAlt = false + return tea.EnterAltScreen, nil + } case "h", "left": m.Leap(-1) case "l", "right": @@ -14,10 +24,11 @@ func (m *Model) HandleInput(msg tea.KeyMsg) (tea.Cmd, error) { case "down", "j": m.Index++ case "q", "esc", "ctrl+c": - m.Quit = true - cmd = tea.Quit + m.Cancel = true + return tea.Quit, nil case "space", " ", "enter", "ctrl+d": - cmd = tea.Quit + m.Done = true + return tea.Quit, nil } m.Validate() |
