Skip to content

Interrupt on Ctrl+C, quit only on a second press - #3

Merged
tdwd merged 1 commit into
mainfrom
feat/ctrl-c-interrupt-then-quit
Jul 29, 2026
Merged

Interrupt on Ctrl+C, quit only on a second press#3
tdwd merged 1 commit into
mainfrom
feat/ctrl-c-interrupt-then-quit

Conversation

@tdwd

@tdwd tdwd commented Jul 29, 2026

Copy link
Copy Markdown
Collaborator

What

Ctrl+C exited immediately, so a reflexive tap dropped the whole session. This gives it the Claude-Code cadence:

  • Turn running → first Ctrl+C interrupts it and hands the prompt back.
  • Idle → first Ctrl+C arms the exit window (nothing to cancel).
  • Either way → a second Ctrl+C within 2s quits.
  • Status bar shows a red ^C AGAIN TO EXIT hint after a press, auto-clearing when the window lapses (a one-shot tick repaints it).
  • During a pending approval, Ctrl+C denies the tool (cancels the action) and arms the window, instead of denying-and-quitting.

Notes

  • Esc and Ctrl+C now share one interrupt(). Quit still returns tea.Quit without closing the engine (preserving the one-ctrl+c-freeze fix).
  • Confirmed against Bubble Tea v1.3.4 source that the keystroke arrives as KeyCtrlC through our handler (raw mode disables ISIG); only an OS SIGINT takes the framework's separate clean-exit path.
  • Tests: quit_test.go (double-tap quits, first press arms, approval deny+arm) and status_test.go (hint renders when armed). Build + go vet + suite green.

Ctrl+C exited immediately, so a reflexive tap dropped the whole session.
Give it the Claude-Code cadence instead: the first press interrupts the
running turn (or, when idle, just arms) and the status bar shows a
"^C again to exit" hint; a second press within a 2s window quits.

Esc and Ctrl+C now share one interrupt(); quitting still returns
tea.Quit without closing the engine (the one-ctrl+c-freeze fix). During
a pending approval, Ctrl+C denies the tool (cancels the action) and arms
the window rather than denying-and-quitting.
@tdwd
tdwd merged commit a85ee38 into main Jul 29, 2026
1 check passed
@tdwd
tdwd deleted the feat/ctrl-c-interrupt-then-quit branch July 29, 2026 13:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant