Skip to content

Conversation

@linw1995
Copy link
Owner

Summary

Add a Force Quit command to the TUI that can be triggered via Ctrl+Q, providing an alternative exit method to Ctrl+C.

Changes

  • actions.rs: Add ForceQuit variant to CommandPaletteAction
  • app.rs: Handle ForceQuit action by setting should_quit flag
  • chat.rs:
    • Introduce ExitShortcut enum to track different exit shortcuts (Ctrl+C/Ctrl+Q)
    • Refactor handle_exit_shortcut to support multiple shortcuts
    • Update cancellation guard to track last used shortcut
    • Improve user prompts to show correct shortcut names
  • command_palette.rs:
    • Add Force Quit command with Ctrl-q shortcut
    • Wire up ForceQuit action in command handler

Behavior

  • Ctrl+C: Existing behavior - double press to cancel/exit
  • Ctrl+Q: New Force Quit command - also double press to cancel/exit
  • Both shortcuts show appropriate prompts based on which key was pressed

This provides users with a dedicated force quit option independent of the terminal's SIGINT handling.

Add a Force Quit command to the TUI command palette that allows users to exit immediately without the double Ctrl+C confirmation.

Changes:
- Add ForceQuit variant to CommandPaletteAction enum
- Add Force Quit command to command palette with Ctrl+Q shortcut
- Handle ForceQuit action in app.rs to set should_quit flag
- Add ForceQuit pattern match in chat.rs component

The command appears in the command palette as 'Force Quit' with the shortcut <C-q>.
@codecov-commenter
Copy link

Codecov Report

❌ Patch coverage is 0% with 39 lines in your changes missing coverage. Please review.
✅ Project coverage is 47.60%. Comparing base (a46f02c) to head (a5cfed3).
⚠️ Report is 15 commits behind head on dev.

Files with missing lines Patch % Lines
crates/coco-tui/src/components/chat.rs 0.00% 30 Missing ⚠️
crates/coco-tui/src/components/command_palette.rs 0.00% 6 Missing ⚠️
crates/coco-tui/src/app.rs 0.00% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##              dev     #159      +/-   ##
==========================================
- Coverage   50.22%   47.60%   -2.63%     
==========================================
  Files          93      100       +7     
  Lines       25033    27308    +2275     
==========================================
+ Hits        12574    12999     +425     
- Misses      12459    14309    +1850     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@linw1995 linw1995 added the enhancement New feature or request label Jan 29, 2026
@linw1995 linw1995 merged commit fb9f701 into dev Jan 29, 2026
3 checks passed
@linw1995 linw1995 deleted the feature/tui-force-exit-command branch January 29, 2026 13:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants