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) <noreply@anthropic.com>
This commit is contained in:
@@ -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() =>
|
||||
|
||||
+5
-5
@@ -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`)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user