TUI: Ctrl/Cmd+Z should restore draft cleared by Ctrl+C
Resolved 💬 4 comments Opened Feb 12, 2026 by mochiexists Closed Feb 12, 2026
💡 Likely answer: A maintainer (etraut-openai, contributor)
responded on this thread — see the highlighted reply below.
In the TUI chat composer, Ctrl+C clears the draft (and records the cleared draft into local composer history so it can be recalled via Up).
Suggestion: when the composer is empty, treat Ctrl+Z (and Super/Cmd+Z where available) as an "undo clear" shortcut that restores the most recently-cleared local draft.
Why
- Matches common user expectation: undo after an accidental clear.
- Reuses existing history rehydration logic; no need for full undo/redo.
Proposed behavior
- Only when composer is empty (so it does not act as a general undo system).
- Key chord: Ctrl+Z and Super+Z (ignore Alt-modified).
- Action:
history.navigate_up(...)+apply_history_entry(...).
Implementation sketch
codex-rs/tui/src/bottom_pane/chat_composer.rs: inhandle_key_event_without_popup, add a match arm forKeyCode::Char('z')with CONTROL or SUPER modifiers andself.is_empty().- Add a small unit test that clears a draft via
clear_for_ctrl_c()then sends Ctrl+Z and asserts the draft text is restored.
Note: this is additive; Up-arrow history recall continues to work as today.
4 Comments
@etraut-openai hi sir I have identified The root cause is straightforward: there is no code to handle Ctrl+Z. The feature simply doesn't exist yet.
###Current Implementation
File:
codex-rs/tui/src/bottom_pane/chat_composer.rs
Function: ChatComposer::handle_key_event_without_popup (lines 2348-2429)
The function handles various key events but does NOT have any case for Ctrl+Z:
@etraut-openai can i proceed with pr it is almost ready
You can use the up arrow to restore the draft cleared by Ctrl+C. No need to add another shortcut for it.
@etraut-openai hiii, i understand this but to me it’s all the more reason to enable the shortcut as the hard part is already done.
it was nice to find that you do already store the history and that up will restore which was a pleasant surprise unlike claude code where it’s gone forever at preset, but for the sake of my muscle memory it would be great to have this as a feature.
please reconsider :)