diff --git a/internal/tui/tui.go b/internal/tui/tui.go index 1c987722b58b883862b71c582ed3800afc946de7..0986aca31dcd779ca6fe611e1d71eff8ad6908e9 100644 --- a/internal/tui/tui.go +++ b/internal/tui/tui.go @@ -406,6 +406,16 @@ func (a *appModel) handleWindowResize(width, height int) tea.Cmd { // handleKeyPressMsg processes keyboard input and routes to appropriate handlers. func (a *appModel) handleKeyPressMsg(msg tea.KeyPressMsg) tea.Cmd { + // Check this first as the user should be able to quit no matter what. + if key.Matches(msg, a.keyMap.Quit) { + if a.dialog.ActiveDialogID() == quit.QuitDialogID { + return tea.Quit + } + return util.CmdHandler(dialogs.OpenDialogMsg{ + Model: quit.NewQuitDialog(), + }) + } + if a.completions.Open() { // completions keyMap := a.completions.KeyMap() @@ -430,14 +440,6 @@ func (a *appModel) handleKeyPressMsg(msg tea.KeyPressMsg) tea.Cmd { a.showingFullHelp = !a.showingFullHelp return a.handleWindowResize(a.wWidth, a.wHeight) // dialogs - case key.Matches(msg, a.keyMap.Quit): - if a.dialog.ActiveDialogID() == quit.QuitDialogID { - return tea.Quit - } - return util.CmdHandler(dialogs.OpenDialogMsg{ - Model: quit.NewQuitDialog(), - }) - case key.Matches(msg, a.keyMap.Commands): // if the app is not configured show no commands if !a.isConfigured {