[PR #9050] feat(tui): implement double Ctrl+C to quit #12964

Open
opened 2026-02-16 18:17:50 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/anomalyco/opencode/pull/9050

State: open
Merged: No


What does this PR do?

Fixes #9041
Implements a "double Ctrl+C to quit" mechanism to prevent accidental session termination.

How did you verify your code works?

Changes

  • Modified packages/opencode/src/cli/cmd/tui/component/prompt/index.tsx.
  • Added quitArmed state to the Prompt component.
  • Updated app_exit keybinding handler:
    • First Press (on empty prompt): Shows a toast "Press Ctrl+C again to exit" and sets a 3-second timeout.
    • Second Press (within 3s): Exits the application.

Testing

  • Verified manually:
    • Pressing Ctrl+C once on empty prompt shows the toast.
    • Pressing again within 3s exits.
    • Pressing again after 3s shows the toast again (timeout reset).
    • Ctrl+C with text still clears the input (existing behavior).
**Original Pull Request:** https://github.com/anomalyco/opencode/pull/9050 **State:** open **Merged:** No --- ### What does this PR do? Fixes #9041 Implements a "double Ctrl+C to quit" mechanism to prevent accidental session termination. ### How did you verify your code works? ## Changes - Modified [packages/opencode/src/cli/cmd/tui/component/prompt/index.tsx](cci:7://file:///Users/shoaib/Downloads/opencode-dev/packages/opencode/src/cli/cmd/tui/component/prompt/index.tsx:0:0-0:0). - Added `quitArmed` state to the Prompt component. - Updated `app_exit` keybinding handler: - **First Press** (on empty prompt): Shows a toast "Press Ctrl+C again to exit" and sets a 3-second timeout. - **Second Press** (within 3s): Exits the application. ## Testing - Verified manually: - Pressing Ctrl+C once on empty prompt shows the toast. - Pressing again within 3s exits. - Pressing again after 3s shows the toast again (timeout reset). - Ctrl+C with text still clears the input (existing behavior).
yindo added the pull-request label 2026-02-16 18:17:50 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#12964