Skip to content

armgit / codex

Public Imported from GitHub
0

Lightweight coding agent that runs in your terminal

Rust

fix(tui): add missing Ctrl+n/Ctrl+p support to ListSelectionView (#7629)

Takuto Yuki4a3e9ed88d0d
diff --git a/codex-rs/tui/src/bottom_pane/list_selection_view.rs b/codex-rs/tui/src/bottom_pane/list_selection_view.rs
index b58524185b..26a32a42e1 100644
--- a/codex-rs/tui/src/bottom_pane/list_selection_view.rs
+++ b/codex-rs/tui/src/bottom_pane/list_selection_view.rs
@@ -268,13 +268,36 @@ impl ListSelectionView {
impl BottomPaneView for ListSelectionView {
fn handle_key_event(&mut self, key_event: KeyEvent) {
match key_event {
+ // Some terminals (or configurations) send Control key chords as
+ // C0 control characters without reporting the CONTROL modifier.
+ // Handle fallbacks for Ctrl-P/N here so navigation works everywhere.
KeyEvent {
code: KeyCode::Up, ..
- } => self.move_up(),
+ }
+ | KeyEvent {
+ code: KeyCode::Char('p'),
+ modifiers: KeyModifiers::CONTROL,
+ ..
+ }
+ | KeyEvent {
+ code: KeyCode::Char('\u{0010}'),
+ modifiers: KeyModifiers::NONE,
+ ..
+ } /* ^P */ => self.move_up(),
KeyEvent {
code: KeyCode::Down,
..
- } => self.move_down(),
+ }
+ | KeyEvent {
+ code: KeyCode::Char('n'),
+ modifiers: KeyModifiers::CONTROL,
+ ..
+ }
+ | KeyEvent {
+ code: KeyCode::Char('\u{000e}'),
+ modifiers: KeyModifiers::NONE,
+ ..
+ } /* ^N */ => self.move_down(),
KeyEvent {
code: KeyCode::Backspace,
..