summaryrefslogtreecommitdiff
path: root/menu/model.go
diff options
context:
space:
mode:
authorewy <ewy0@protonmail.com>2026-04-14 19:23:00 +0200
committerewy <ewy0@protonmail.com>2026-04-14 19:23:00 +0200
commit50d7be8d947b71e4dba181314fcf3392100d0080 (patch)
treed8106c362486bbd194c79e9fe2e2075e4eb6029d /menu/model.go
parent4fd3756396bcdb6ecad4b2a836c68349e797004d (diff)
cleanup
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]
}