diff --git a/codex-rs/tui/src/bottom_pane/approval_overlay.rs b/codex-rs/tui/src/bottom_pane/approval_overlay.rs index ce51b25832..9fb8c55ec0 100644 --- a/codex-rs/tui/src/bottom_pane/approval_overlay.rs +++ b/codex-rs/tui/src/bottom_pane/approval_overlay.rs @@ -367,6 +367,9 @@ impl ApprovalOverlay { let prefix_label = format!("{prefix} {}. ", idx + 1); GenericDisplayRow { name: format!("{prefix_label}{}", option.label), + display_shortcut: option + .display_shortcut + .or_else(|| option.additional_shortcuts.first().copied()), wrap_indent: Some(UnicodeWidthStr::width(prefix_label.as_str())), ..Default::default() } @@ -1275,7 +1278,7 @@ fn patch_options() -> Vec { ApprovalOption { label: "No, and tell Codex what to do differently".to_string(), decision: ApprovalDecision::PatchRejectWithNotes, - display_shortcut: None, + display_shortcut: Some(key_hint::plain(KeyCode::Tab)), additional_shortcuts: vec![key_hint::plain(KeyCode::Char('n'))], }, ] @@ -1850,12 +1853,24 @@ mod tests { } #[test] - fn patch_option_three_no_longer_shows_esc_shortcut() { + fn patch_options_show_expected_shortcuts() { let (tx, _rx) = unbounded_channel::(); let tx = AppEventSender::new(tx); let view = ApprovalOverlay::new(make_patch_request(), tx, Features::with_defaults()); let rendered = render_overlay_lines(&view, 80); + assert!( + rendered.contains("(y)"), + "patch option should show y shortcut: {rendered}" + ); + assert!( + rendered.contains("(a)"), + "patch option should show a shortcut: {rendered}" + ); + assert!( + rendered.contains("(tab)"), + "patch option should show tab shortcut: {rendered}" + ); assert!( !rendered.contains("(esc)"), "patch option should not show esc shortcut: {rendered}" diff --git a/codex-rs/tui/src/bottom_pane/snapshots/codex_tui__bottom_pane__approval_overlay__tests__approval_overlay_patch_notes_visible.snap b/codex-rs/tui/src/bottom_pane/snapshots/codex_tui__bottom_pane__approval_overlay__tests__approval_overlay_patch_notes_visible.snap index e0082e6cbd..56a2b19506 100644 --- a/codex-rs/tui/src/bottom_pane/snapshots/codex_tui__bottom_pane__approval_overlay__tests__approval_overlay_patch_notes_visible.snap +++ b/codex-rs/tui/src/bottom_pane/snapshots/codex_tui__bottom_pane__approval_overlay__tests__approval_overlay_patch_notes_visible.snap @@ -13,9 +13,9 @@ expression: "render_overlay_lines(&view, 80)" 1 +hello 2 +world - 1. Yes, proceed - 2. Yes, and don't ask again for these files - › 3. No, and tell Codex what to do differently + 1. Yes, proceed (y) + 2. Yes, and don't ask again for these files (a) + › 3. No, and tell Codex what to do differently (tab) enter to send | tab to go back | esc to interrupt › split the changes by file diff --git a/codex-rs/tui/src/bottom_pane/snapshots/codex_tui__bottom_pane__approval_overlay__tests__approval_overlay_patch_reject_selected.snap b/codex-rs/tui/src/bottom_pane/snapshots/codex_tui__bottom_pane__approval_overlay__tests__approval_overlay_patch_reject_selected.snap index 18d52936f1..b90be3a204 100644 --- a/codex-rs/tui/src/bottom_pane/snapshots/codex_tui__bottom_pane__approval_overlay__tests__approval_overlay_patch_reject_selected.snap +++ b/codex-rs/tui/src/bottom_pane/snapshots/codex_tui__bottom_pane__approval_overlay__tests__approval_overlay_patch_reject_selected.snap @@ -13,7 +13,7 @@ expression: "render_overlay_lines(&view, 80)" 1 +hello 2 +world - 1. Yes, proceed - 2. Yes, and don't ask again for these files - › 3. No, and tell Codex what to do differently + 1. Yes, proceed (y) + 2. Yes, and don't ask again for these files (a) + › 3. No, and tell Codex what to do differently (tab) tab to follow up | esc to interrupt diff --git a/codex-rs/tui/src/chatwidget/snapshots/codex_tui__chatwidget__tests__approval_modal_patch.snap b/codex-rs/tui/src/chatwidget/snapshots/codex_tui__chatwidget__tests__approval_modal_patch.snap index c0f3f97456..6bf602b5c3 100644 --- a/codex-rs/tui/src/chatwidget/snapshots/codex_tui__chatwidget__tests__approval_modal_patch.snap +++ b/codex-rs/tui/src/chatwidget/snapshots/codex_tui__chatwidget__tests__approval_modal_patch.snap @@ -14,7 +14,7 @@ expression: terminal.backend().vt100().screen().contents() 1 +hello 2 +world - › 1. Yes, proceed - 2. Yes, and don't ask again for these files - 3. No, and tell Codex what to do differently + › 1. Yes, proceed (y) + 2. Yes, and don't ask again for these files (a) + 3. No, and tell Codex what to do differently (tab) esc to interrupt diff --git a/codex-rs/tui/src/chatwidget/snapshots/codex_tui__chatwidget__tests__approval_modal_patch_notes.snap b/codex-rs/tui/src/chatwidget/snapshots/codex_tui__chatwidget__tests__approval_modal_patch_notes.snap index 86c19b9948..10a5ef4fb6 100644 --- a/codex-rs/tui/src/chatwidget/snapshots/codex_tui__chatwidget__tests__approval_modal_patch_notes.snap +++ b/codex-rs/tui/src/chatwidget/snapshots/codex_tui__chatwidget__tests__approval_modal_patch_notes.snap @@ -14,9 +14,9 @@ expression: terminal.backend().vt100().screen().contents() 1 +hello 2 +world - 1. Yes, proceed - 2. Yes, and don't ask again for these files - › 3. No, and tell Codex what to do differently + 1. Yes, proceed (y) + 2. Yes, and don't ask again for these files (a) + › 3. No, and tell Codex what to do differently (tab) enter to send | tab to go back | esc to interrupt › split the edits into smaller commits diff --git a/codex-rs/tui/src/history_cell.rs b/codex-rs/tui/src/history_cell.rs index 3c26e53a0f..8012e5acd9 100644 --- a/codex-rs/tui/src/history_cell.rs +++ b/codex-rs/tui/src/history_cell.rs @@ -2162,6 +2162,7 @@ pub(crate) fn new_patch_event( pub(crate) fn new_patch_apply_failure(stderr: String) -> PlainHistoryCell { let mut lines: Vec> = Vec::new(); + // Failure title lines.push(Line::from("✘ Failed to apply patch".magenta().bold())); if !stderr.trim().is_empty() {