diff --git a/file/file.go b/file/file.go index 791d1df3a..e8d43ca42 100644 --- a/file/file.go +++ b/file/file.go @@ -26,10 +26,15 @@ import ( type keymap filepicker.KeyMap var keyQuit = key.NewBinding( - key.WithKeys("esc", "q", "ctrl+c"), + key.WithKeys("esc", "q"), key.WithHelp("esc", "close"), ) +var keyAbort = key.NewBinding( + key.WithKeys("ctrl+c"), + key.WithHelp("ctrl+c", "abort"), +) + func defaultKeymap() keymap { km := filepicker.DefaultKeyMap() km.Down.SetHelp("↓", "down") @@ -76,11 +81,13 @@ func (m model) Update(msg tea.Msg) (tea.Model, tea.Cmd) { switch msg := msg.(type) { case tea.KeyMsg: switch { - // TODO: should this handle q and esc differently than ctrl+c? - case key.Matches(msg, keyQuit): + case key.Matches(msg, keyAbort): m.aborted = true m.quitting = true return m, tea.Quit + case key.Matches(msg, keyQuit): + m.quitting = true + return m, tea.Quit } case timeout.TickTimeoutMsg: if msg.TimeoutValue <= 0 {