feat(tui): Ctrl+X leader chords and emacs menu navigation#699
Conversation
Add Ctrl+X leader shortcuts for common slash commands (with Ctrl+X ? chord map), and Ctrl+P/N previous/next selection in modals and pickers.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (4)
💤 Files with no reviewable changes (1)
🚧 Files skipped from review as they are similar to previous changes (2)
WalkthroughThe TUI adds timed ChangesTUI keyboard interactions
Estimated code review effort: 3 (Moderate) | ~25 minutes Sequence Diagram(s)sequenceDiagram
participant User
participant TUI
participant ModalSelection
participant PickerOrPrompt
User->>TUI: Ctrl+P or Ctrl+N
TUI->>ModalSelection: moveModalSelection(delta)
ModalSelection->>PickerOrPrompt: move active selection
PickerOrPrompt-->>TUI: updated cursor or selected item
Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@internal/tui/leader.go`:
- Line 31: Remove the 'e' to "/edit" entry from the leader mappings in leader.go
so Ctrl+X e no longer exposes a command that replaces the composer and discards
an in-progress draft. Preserve the remaining draft-preserving mappings
unchanged.
In `@internal/tui/model.go`:
- Around line 1268-1280: Update the Ctrl+N handling around moveModalSelection so
that, when no modal selection surface handles the key, idle Ctrl+N is consumed
as a no-op instead of falling through to configurable global bindings; preserve
modal navigation behavior and existing Ctrl+P handling.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 2c2e5d22-6ad0-4dae-8288-b1af225c3d9f
📒 Files selected for processing (11)
CHANGELOG.mdREADME.mdinternal/tui/keybinding_help.gointernal/tui/keybinding_help_test.gointernal/tui/leader.gointernal/tui/leader_test.gointernal/tui/modal_selection.gointernal/tui/modal_selection_test.gointernal/tui/model.gointernal/tui/onboarding.gointernal/tui/sidebar.go
/edit replaces the composer and would discard an in-progress draft; leave it unbound so leader shortcuts stay draft-preserving.
Reserve Ctrl+N for emacs menu navigation so it never falls through to remapped global bindings when no selection surface is open.
There was a problem hiding this comment.
Nice work this is clean and well-tested. The leader-chord and Ctrl+P/Ctrl+N refactor is behavior-preserving (the Shift+arrow suggestion break is kept, plain arrows route through moveModalSelection), it builds, vets, and gofmts clean, and the new leader/modal tests pass in the worktree. One thing worth a gut-check before merge: idle Ctrl+N is now a reserved no-op that never reaches configurable global bindings, so anyone who remapped a binding (e.g. toggleSidebar) to Ctrl+N silently loses it the CHANGELOG calls this out, just confirm you're fine burning that binding.
Adds two related TUI keyboard improvements:
Both are discoverable via the
?help overlay, README controls table, idle composer hints, and (for leader chords) a dedicated Ctrl+X ? modal styled like the keyboard-shortcut overlay.Motivation
/model,/provider,/resume, …) still required typing/…+ Enter mid-session.Ctrl+X leader (slash shortcuts)
Ctrl+Xthen letterCtrl+X?Esc/ secondCtrl+X/ ~2s timeoutm/modelp/providerP/planM/stt-modelv/voicec/clearC/contexts/stopi/imager/resumeu/rewindt/toolse/editR/retryexecuteSlash/dispatchCommandpath so chords behave like submitting the slash command.?overlay (styledBlockFillTitle+ panel fill).Emacs Ctrl+P / Ctrl+N (menu navigation)
Ctrl+PCtrl+NSurfaces: model/theme/effort/session/skill pickers, slash & file suggestions, permission prompts, ask_user option lists, provider/MCP wizards & managers, onboarding setup lists.
Precedence: while a selection surface is active, Ctrl+P/N move the highlight and do not toggle the plan panel. Idle Ctrl+P still expands/collapses the plan when no menu is open. Idle Ctrl+N remains a no-op (remapped bindings like
toggleSidebar: ctrl+nstill work).shared
moveModalSelection(delta)used by arrows and Ctrl+P/N.Follow up if merged:
Summary by CodeRabbit
Ctrl+Xleader-chord shortcuts for common wired slash commands, plusCtrl+X ?to show allCtrl+Xchords; incomplete sequences cancel viaEsc, a secondCtrl+X, or timeout.Ctrl+P/Ctrl+Nnavigation across menu and picker flows (including suggestions). When no menu is open,Ctrl+Ptoggles the plan panel; idleCtrl+Nis a no-op.