summaryrefslogtreecommitdiff
path: root/menu/model.go
diff options
context:
space:
mode:
Diffstat (limited to 'menu/model.go')
-rw-r--r--menu/model.go5
1 files changed, 5 insertions, 0 deletions
diff --git a/menu/model.go b/menu/model.go
index ceeb861..9d8fa82 100644
--- a/menu/model.go
+++ b/menu/model.go
@@ -11,6 +11,7 @@ type Model struct {
Index int
Indices map[int]model.HydratedTarget
SourceIndices map[int]*model.HydratedSource
+ Quit bool
}
func (m *Model) Init() tea.Cmd {
@@ -40,6 +41,7 @@ func (m *Model) HandleInput(msg tea.KeyMsg) (tea.Cmd, error) {
case "down", "j":
m.Index++
case "q", "esc":
+ m.Quit = true
cmd = tea.Quit
case "space", " ", "enter":
cmd = tea.Quit
@@ -59,6 +61,9 @@ func (m *Model) View() string {
}
func (m *Model) Result() (*model.HydratedSource, model.HydratedTarget) {
+ if m.Quit {
+ return nil, nil
+ }
return m.SourceIndices[m.Index], m.Indices[m.Index]
}