Skip to content

fix(ui): prompt to quit on ctrl+d - #2520

Open
officialasishkumar wants to merge 1 commit into
charmbracelet:mainfrom
officialasishkumar:fix/2428-ctrl-d-quit
Open

fix(ui): prompt to quit on ctrl+d#2520
officialasishkumar wants to merge 1 commit into
charmbracelet:mainfrom
officialasishkumar:fix/2428-ctrl-d-quit

Conversation

@officialasishkumar

Copy link
Copy Markdown
Contributor

Summary

Treat ctrl+d like EOF in the editor when the prompt is empty by opening the existing quit confirmation dialog.

Problem

ctrl+d is a common REPL EOF shortcut, but Crush currently ignores it in the editor unless the user types quit or uses ctrl+c.

Before

  1. Start Crush and focus the prompt editor.
  2. Leave the prompt empty.
  3. Press ctrl+d.
  4. Nothing happens.

After

  1. Pressing ctrl+d with an empty editor opens the existing quit dialog.
  2. Existing compact-mode ctrl+d details behavior is unchanged outside the empty-editor EOF case.
  3. ctrl+d does not prompt to quit when there is typed input or pending attachments.

Changes

  • Add a narrow EOF check in key handling for ctrl+d while the editor is focused.
  • Reuse the existing quit confirmation dialog instead of adding a new quit path.
  • Add regression tests for the empty-editor case and guards for typed input and attachments.

Test Plan

  • go test ./internal/ui/model

Closes #2428

@officialasishkumar
officialasishkumar requested a review from a team as a code owner March 28, 2026 14:42
@officialasishkumar
officialasishkumar requested review from andreynering and raphamorim and removed request for a team March 28, 2026 14:42
@charmcli

Copy link
Copy Markdown
Contributor

Thank you for your submission. We really appreciate it! Like many open-source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution. You can sign the CLA by just posting a Pull Request comment same as the below format.


I have read the Contributor License Agreement (CLA) and hereby sign the CLA.


You can retrigger this bot by commenting recheck in this Pull Request. Posted by the CLA Assistant Lite bot.

Bojun-Vvibe added a commit to Bojun-Vvibe/oss-contributions that referenced this pull request May 5, 2026
- google-gemini/gemini-cli#26225 MessageBus fail-fast — merge-after-nits
- QwenLM/qwen-code#3627 macOS desktop installer — merge-after-nits
- aaif-goose/goose#9014 unread state for background chats — merge-after-nits
- charmbracelet/crush#2520 Ctrl+D quit prompt — merge-as-is
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.

ctrl+d doesn't exit or prompt to exit

2 participants