From e30f65118d8adb56bb4243dd3ac3497e25f86516 Mon Sep 17 00:00:00 2001 From: Ejaz Ahmed <47801736+ejazahm3d@users.noreply.github.com> Date: Fri, 7 Nov 2025 03:58:18 +0500 Subject: [PATCH] feat: Enable CTRL-n and CTRL-p for navigating slash commands, files, history (#1994) Adds CTRL-n and CTRL-p navigation for slash commands, files, and history. Closes #1992 Co-authored-by: Eric Traut --- codex-rs/tui/src/bottom_pane/chat_composer.rs | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/codex-rs/tui/src/bottom_pane/chat_composer.rs b/codex-rs/tui/src/bottom_pane/chat_composer.rs index 61539b6e..446563a1 100644 --- a/codex-rs/tui/src/bottom_pane/chat_composer.rs +++ b/codex-rs/tui/src/bottom_pane/chat_composer.rs @@ -410,6 +410,11 @@ impl ChatComposer { match key_event { KeyEvent { code: KeyCode::Up, .. + } + | KeyEvent { + code: KeyCode::Char('p'), + modifiers: KeyModifiers::CONTROL, + .. } => { popup.move_up(); (InputResult::None, true) @@ -417,6 +422,11 @@ impl ChatComposer { KeyEvent { code: KeyCode::Down, .. + } + | KeyEvent { + code: KeyCode::Char('n'), + modifiers: KeyModifiers::CONTROL, + .. } => { popup.move_down(); (InputResult::None, true) @@ -584,6 +594,11 @@ impl ChatComposer { match key_event { KeyEvent { code: KeyCode::Up, .. + } + | KeyEvent { + code: KeyCode::Char('p'), + modifiers: KeyModifiers::CONTROL, + .. } => { popup.move_up(); (InputResult::None, true) @@ -591,6 +606,11 @@ impl ChatComposer { KeyEvent { code: KeyCode::Down, .. + } + | KeyEvent { + code: KeyCode::Char('n'), + modifiers: KeyModifiers::CONTROL, + .. } => { popup.move_down(); (InputResult::None, true) @@ -870,6 +890,11 @@ impl ChatComposer { KeyEvent { code: KeyCode::Up | KeyCode::Down, .. + } + | KeyEvent { + code: KeyCode::Char('p') | KeyCode::Char('n'), + modifiers: KeyModifiers::CONTROL, + .. } => { if self .history @@ -878,6 +903,8 @@ impl ChatComposer { let replace_text = match key_event.code { KeyCode::Up => self.history.navigate_up(&self.app_event_tx), KeyCode::Down => self.history.navigate_down(&self.app_event_tx), + KeyCode::Char('p') => self.history.navigate_up(&self.app_event_tx), + KeyCode::Char('n') => self.history.navigate_down(&self.app_event_tx), _ => unreachable!(), }; if let Some(text) = replace_text {