Skip to content

Commit 4a3e9ed

Browse files
fix(tui): add missing Ctrl+n/Ctrl+p support to ListSelectionView (#7629)
## Summary Extend Ctrl+n/Ctrl+p navigation support to selection popups (model picker, approval mode, etc.) This is a follow-up to #7530, which added Ctrl+n/Ctrl+p navigation to the textarea. The same keybindings were missing from `ListSelectionView`, causing inconsistent behavior when navigating selection popups. ## Related - #7530 - feat(tui): map Ctrl-P/N to arrow navigation in textarea ## Changes - Added Ctrl+n as alternative to Down arrow in selection popups - Added Ctrl+p as alternative to Up arrow in selection popups - Added unit tests for the new keybindings ## Test Plan - [x] `cargo test -p codex-tui list_selection_view` - all tests pass - [x] Manual testing: verified Ctrl+n/p navigation works in model selection popup --------- Co-authored-by: Eric Traut <etraut@openai.com>
1 parent 28e7218 commit 4a3e9ed

File tree

1 file changed

+25
-2
lines changed

1 file changed

+25
-2
lines changed

codex-rs/tui/src/bottom_pane/list_selection_view.rs

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -268,13 +268,36 @@ impl ListSelectionView {
268268
impl BottomPaneView for ListSelectionView {
269269
fn handle_key_event(&mut self, key_event: KeyEvent) {
270270
match key_event {
271+
// Some terminals (or configurations) send Control key chords as
272+
// C0 control characters without reporting the CONTROL modifier.
273+
// Handle fallbacks for Ctrl-P/N here so navigation works everywhere.
271274
KeyEvent {
272275
code: KeyCode::Up, ..
273-
} => self.move_up(),
276+
}
277+
| KeyEvent {
278+
code: KeyCode::Char('p'),
279+
modifiers: KeyModifiers::CONTROL,
280+
..
281+
}
282+
| KeyEvent {
283+
code: KeyCode::Char('\u{0010}'),
284+
modifiers: KeyModifiers::NONE,
285+
..
286+
} /* ^P */ => self.move_up(),
274287
KeyEvent {
275288
code: KeyCode::Down,
276289
..
277-
} => self.move_down(),
290+
}
291+
| KeyEvent {
292+
code: KeyCode::Char('n'),
293+
modifiers: KeyModifiers::CONTROL,
294+
..
295+
}
296+
| KeyEvent {
297+
code: KeyCode::Char('\u{000e}'),
298+
modifiers: KeyModifiers::NONE,
299+
..
300+
} /* ^N */ => self.move_down(),
278301
KeyEvent {
279302
code: KeyCode::Backspace,
280303
..

0 commit comments

Comments
 (0)