[rust] Ctrl+D should only quit when the input line is empty
Resolved 💬 5 comments Opened Jul 1, 2025 by artdent Closed Jul 16, 2025
💡 Likely answer: A maintainer (bolinfest, collaborator)
responded on this thread — see the highlighted reply below.
What version of Codex is running?
codex-cli 0.2.0
Which model were you using?
o4-mini
What platform is your computer?
Darwin 24.5.0 arm64 arm
What steps can reproduce the bug?
Start typing a command; move the cursor around to the middle of the line; then hit ctrl+d to attempt to delete the character under the cursor.
What is the expected behavior?
The character under the cursor should be deleted.
What do you see instead?
The app exits.
Additional information
One fix would be to only trap ctrl+d if the line is empty; otherwise, use the default TUI handler. Another fix would be to abandon ctrl+d as the keybinding to exit the app, since it is redundant with hitting ctrl+c twice.
5 Comments
In many editors and shells, pressing Ctrl+D usually deletes the character under/after the cursor. From my experience, it's disruptive when Codex quits after accidentally pressing Ctrl+D while trying to edit a sentence.
Codex team, please consider using Ctrl+C to quit instead. Thanks
@bolinfest you want to keep Ctrl+D. Are you open, at least, to what has been suggested in this ticket, i.e., "only trap ctrl+d if the line is empty"? This will satisfy your need/desire and still mitigate the problem of accidentally pressing it to delete a character.
@rxaviers Given that
nodeandpython3REPLs work this way (sorry, I only just now had a chance to test), yes, I'm open to it. Looking now.Thank you @bolinfest !!
thank god for this fix 🙏