From 6ac93e81c7c9c9eccd6a5e89a419867439890b38 Mon Sep 17 00:00:00 2001 From: 1Kill2Steal <171241044+1Git2Clone@users.noreply.github.com> Date: Sat, 13 Jun 2026 08:07:29 -0700 Subject: [PATCH] feat(tui): add Ctrl+P/N slash-menu navigation Adds Ctrl+P and Ctrl+N as Emacs-style alternatives for slash-command autocomplete navigation while keeping the global Ctrl+P file picker from stealing focus when the slash menu is open. Harvested from PR #3196 by @1Git2Clone. Co-Authored-By: Claude Opus 4.8 (1M context) --- crates/tui/src/tui/ui.rs | 13 ++++++++++++- docs/KEYBINDINGS.md | 10 +++++----- 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/crates/tui/src/tui/ui.rs b/crates/tui/src/tui/ui.rs index 1919ddc0..6116134e 100644 --- a/crates/tui/src/tui/ui.rs +++ b/crates/tui/src/tui/ui.rs @@ -3386,10 +3386,11 @@ async fn run_event_loop( } // Ctrl+P opens the fuzzy file-picker overlay. Bound only when the - // composer is focused (no other modal on top of the stack) and the + // composer is focused (no other modal or inline popup on top) and the // engine is not actively streaming a turn. if key.code == KeyCode::Char('p') && key.modifiers.contains(KeyModifiers::CONTROL) + && visible_slash_menu_entries(app, SLASH_MENU_LIMIT).is_empty() && app.view_stack.is_empty() && !app.is_loading { @@ -3901,6 +3902,11 @@ async fn run_event_loop( KeyCode::Up if key.modifiers.is_empty() && slash_menu_open => { select_previous_slash_menu_entry(app, slash_menu_entries.len()); } + KeyCode::Char('p') + if key.modifiers.contains(KeyModifiers::CONTROL) && slash_menu_open => + { + select_previous_slash_menu_entry(app, slash_menu_entries.len()); + } KeyCode::Up if key.modifiers.is_empty() && app.selected_composer_attachment_index().is_some() => @@ -3947,6 +3953,11 @@ async fn run_event_loop( KeyCode::Down if key.modifiers.is_empty() && slash_menu_open => { select_next_slash_menu_entry(app, slash_menu_entries.len()); } + KeyCode::Char('n') + if key.modifiers.contains(KeyModifiers::CONTROL) && slash_menu_open => + { + select_next_slash_menu_entry(app, slash_menu_entries.len()); + } KeyCode::Down if key.modifiers.is_empty() && app.selected_composer_attachment_index().is_some() => diff --git a/docs/KEYBINDINGS.md b/docs/KEYBINDINGS.md index 15de55db..eb1f63a3 100644 --- a/docs/KEYBINDINGS.md +++ b/docs/KEYBINDINGS.md @@ -80,11 +80,11 @@ When `[memory] enabled = true`, typing `# foo` and pressing `Enter` appends `foo ## Slash-command palette (after `Ctrl-K` or typing `/`) -| Chord | Action | -|----------------------|-----------------------------------------------------| -| `↑` / `↓` | Move selection | -| `Enter` / `Tab` | Run / complete the highlighted command | -| `Esc` | Dismiss palette | +| Chord | Action | +|--------------------------------|-----------------------------------------------------| +| `↑` / `↓` / `Ctrl+P` / `Ctrl+N`| Move selection | +| `Enter` / `Tab` | Run / complete the highlighted command | +| `Esc` | Dismiss palette | ## Session Picker (`Ctrl-R` or `/sessions`)