on main help sign in
fix: ensure it's possible to quit (`ctrl+c`) even when a dialog is open (#1007)
commita4da218e56cfb87695723f72f2cb0eb336919a51 authorAndrey Nering <andreynering@users.noreply.github.com> dateThu 11 Sep 2025, 13:51 (1 year ago) parent49d86a7
1 file changed+10−8
internal/tui/tui.go+10−8
internal/tui/tui.go+10−8
@@ -406,6 +406,16 @@ func (a *appModel) handleWindowResize(width, height int) tea.Cmd {
406406
407407// handleKeyPressMsg processes keyboard input and routes to appropriate handlers.
408408func (a *appModel) handleKeyPressMsg(msg tea.KeyPressMsg) tea.Cmd {
409+ // Check this first as the user should be able to quit no matter what.
410+ if key.Matches(msg, a.keyMap.Quit) {
411+ if a.dialog.ActiveDialogID() == quit.QuitDialogID {
412+ return tea.Quit
413+ }
414+ return util.CmdHandler(dialogs.OpenDialogMsg{
415+ Model: quit.NewQuitDialog(),
416+ })
417+ }
418+
409419 if a.completions.Open() {
410420 // completions
411421 keyMap := a.completions.KeyMap()
@@ -430,14 +440,6 @@ func (a *appModel) handleKeyPressMsg(msg tea.KeyPressMsg) tea.Cmd {
430440 a.showingFullHelp = !a.showingFullHelp
431441 return a.handleWindowResize(a.wWidth, a.wHeight)
432442 // dialogs
433− case key.Matches(msg, a.keyMap.Quit):
434− if a.dialog.ActiveDialogID() == quit.QuitDialogID {
435− return tea.Quit
436− }
437− return util.CmdHandler(dialogs.OpenDialogMsg{
438− Model: quit.NewQuitDialog(),
439− })
440−
441443 case key.Matches(msg, a.keyMap.Commands):
442444 // if the app is not configured show no commands
443445 if !a.isConfigured {