TUI: Ctrl/Cmd+Z should restore draft cleared by Ctrl+C
Resolved 💬 4 comments Opened Feb 12, 2026 by mochiexists Closed Feb 12, 2026
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.
This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗