Skip to content

fix(input): allow ctrl+n & ctrl+p keybinds in session navigator modal - #2271

Open
jplew wants to merge 1 commit into
herdrdev:masterfrom
jplew:fix/session-navigator-movement-bindings
Open

fix(input): allow ctrl+n & ctrl+p keybinds in session navigator modal#2271
jplew wants to merge 1 commit into
herdrdev:masterfrom
jplew:fix/session-navigator-movement-bindings

Conversation

@jplew

@jplew jplew commented Aug 4, 2026

Copy link
Copy Markdown

Summary

It pains me that I can't rebind up/down motion in the Navigator modal (prefix+g) to Vim/Emacs-style ctrl+n and ctrl+p.

This PR fixes Session Navigator movement so ctrl+n / ctrl+p are configurable and work both before and after focusing search. The default bindings preserve the existing search-focused behavior while extending it to the normal navigator view.

  • add keys.navigate_navigator_up and keys.navigate_navigator_down
  • keep the workspace-picker movement bindings independent, so the same keys can be configured in both modes
  • preserve the built-in j/k and arrow-key movement plus navigator commands
  • surface the bindings in generated config, keybind help, and the config reference

Verification

  • ZIG=/home/ubuntu/Sites/.tools/zig-x86_64-linux-0.15.2/zig just check
    • 3,183 nextest tests passed
    • lint, Windows-target clippy, config-reference and maintenance checks passed
  • focused navigator/keybind and keybind-help tests passed

Docs

Updated the unreleased config reference and generated default-config comments for the new bindings.

@kangal-bot kangal-bot added the ai-review Trigger automated AI reviews for pull requests admitted by the PR gate label Aug 4, 2026
@coderabbitai

coderabbitai Bot commented Aug 4, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

The change adds configurable session navigator up and down bindings with ctrl+p and ctrl+n defaults, runtime handling with reserved-key validation, and keybinding help documentation.

Changes

Session navigator bindings

Layer / File(s) Summary
Configuration models and defaults
src/config/model.rs, src/config/keybinds.rs, src/main.rs, docs/next/website/src/data/config-reference.json
KeysConfig gains navigate_navigator_up and navigate_navigator_down fields. Keybinds gains a NavigatorKeybinds struct with up and down ActionKeybinds. Configuration overlays, deserialization, and local profile generation support the new bindings. Default values are ctrl+p and ctrl+n.
Keybinding registry and validation
src/config/keybinds.rs
A separate navigator binding registry parses the configured bindings and applies navigator-specific runtime key reservations. Validation reuses navigation checks and rejects unmodified or shift-only printable characters to prevent search-input conflicts. Tests cover independent navigator and workspace picker bindings and rejection of invalid navigator keys.
Navigator input handling
src/app/input/modal.rs
Navigator event handling checks configured up and down bindings before other navigator input, moves selection, and returns immediately. Search-mode Ctrl-N and Ctrl-P movement branches are removed. Tests verify configured bindings work in normal and focused-search states and built-in Down, Up, J, and K movement remains available.
Keybinding help display
src/ui/keybind_help.rs, src/ui.rs
Navigation help includes a session navigator selection entry that displays the configured up and down shortcuts. UI tests verify the shortcuts appear with their configured values.

Estimated code review effort: 3 (Moderate) | ~25 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly describes making Ctrl+N and Ctrl+P configurable for movement in the session navigator modal.
Description check ✅ Passed The description directly explains the navigator keybinding changes, preserved behavior, documentation updates, and verification results.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands.

@greptile-apps

greptile-apps Bot commented Aug 4, 2026

Copy link
Copy Markdown

Greptile Summary

The PR makes Session Navigator movement configurable in both normal and search-focused views while preserving existing movement commands.

  • Adds independent navigate_navigator_up and navigate_navigator_down configuration fields with ctrl+p and ctrl+n defaults.
  • Validates navigator bindings against reserved commands and printable search input.
  • Updates keybinding help, generated configuration comments, reference documentation, and focused tests.

Confidence Score: 5/5

The PR appears safe to merge.

No blocking failure remains; the previously reported printable-binding conflict is addressed by rejecting the unmodified and Shift-only character bindings accepted by navigator search input.

Important Files Changed

Filename Overview
src/app/input/modal.rs Routes configured navigator movement bindings before mode-specific handling and tests normal, search-focused, and built-in movement.
src/config/keybinds.rs Adds an independent navigator binding registry and rejects unmodified or Shift-only character bindings that would conflict with search input.
src/config/model.rs Adds the navigator movement fields consistently across deserialization, overlays, effective configuration, and defaults.
src/ui/keybind_help.rs Displays the effective Session Navigator movement bindings in navigation help.
docs/next/website/src/data/config-reference.json Documents both new configuration keys and their defaults.

Reviews (2): Last reviewed commit: "fix(input): configure session navigator ..." | Re-trigger Greptile

Comment thread src/config/keybinds.rs

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
src/app/input/modal.rs (1)

1897-1931: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Test a non-default navigator binding.

Both tests use only the default bindings. A hardcoded Ctrl+N/Ctrl+P implementation would pass them.

  • src/app/input/modal.rs#L1897-L1931: set state.keybinds.navigator.up and state.keybinds.navigator.down to non-default direct bindings. Test both normal and search-focused navigator states.
  • src/ui.rs#L1440-L1473: set the same non-default bindings. Assert that keybinding help displays their labels.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: c4d677b9-0d6c-46c8-a8c3-acec20449f24

📥 Commits

Reviewing files that changed from the base of the PR and between adb50cb and 7fb7692.

📒 Files selected for processing (7)
  • docs/next/website/src/data/config-reference.json
  • src/app/input/modal.rs
  • src/config/keybinds.rs
  • src/config/model.rs
  • src/main.rs
  • src/ui.rs
  • src/ui/keybind_help.rs

@jplew
jplew force-pushed the fix/session-navigator-movement-bindings branch from 7fb7692 to 9fffd06 Compare August 4, 2026 09:09
@jplew

jplew commented Aug 4, 2026

Copy link
Copy Markdown
Author

Addressed the automated review feedback in 9fffd06: printable search-input bindings are now rejected, and tests exercise non-default ctrl+alt+p / ctrl+alt+n bindings in both navigator states and in keybind help. Local just check passed again.

@jplew jplew changed the title fix(input): configure session navigator movement fix(input): allow ctrl+n & ctrl+p keybinds in session navigator modal Aug 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ai-review Trigger automated AI reviews for pull requests admitted by the PR gate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants