Skip to content

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

Open
jplew wants to merge 2 commits 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 2 commits into
herdrdev:masterfrom
jplew:fix/session-navigator-movement-bindings

Conversation

@jplew

@jplew jplew commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

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

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: aff45341-c039-4cf1-bcfd-96d06f3df61c

📥 Commits

Reviewing files that changed from the base of the PR and between 6e8b138 and dd17fbb.

📒 Files selected for processing (8)
  • docs/next/CHANGELOG.md
  • 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
🚧 Files skipped from review as they are similar to previous changes (7)
  • docs/next/website/src/data/config-reference.json
  • src/main.rs
  • src/ui/keybind_help.rs
  • src/ui.rs
  • src/config/model.rs
  • src/config/keybinds.rs
  • src/app/input/modal.rs

Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.


📝 Walkthrough

Walkthrough

The change adds configurable session navigator up and down bindings with ctrl+p and ctrl+n defaults. It updates runtime handling, key validation, configuration support, and keybinding help output.

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, docs/next/CHANGELOG.md
KeysConfig and Keybinds support navigator up and down bindings. Configuration overlays, deserialization, profile generation, defaults, reference documentation, and changelog entries include the new bindings.
Keybinding registry and validation
src/config/keybinds.rs
A separate navigator registry parses the bindings and applies runtime reservations. Validation rejects unmodified or shift-only printable keys that conflict with search input. Tests cover independent bindings and invalid navigator keys.
Navigator input handling
src/app/input/modal.rs
Navigator input checks configured bindings before other input and moves the selection. Tests cover normal and focused-search views and built-in movement keys.
Keybinding help display
src/ui/keybind_help.rs, src/ui.rs
Navigation help displays the configured session navigator movement bindings. UI tests verify the configured values.

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

Merge Risk: ⚪ Minimal · up to dd17f

This localized change adds configurable navigator movement bindings while preserving existing behavior, and no actionable merge-blocking risk remains after normal checks and review.

Sequence Diagram(s)

sequenceDiagram
  participant Configuration
  participant NavigatorInput
  participant KeybindHelp

  Configuration->>NavigatorInput: provide navigator up/down bindings
  NavigatorInput->>NavigatorInput: match configured input and move selection
  Configuration->>KeybindHelp: provide effective bindings
  KeybindHelp-->>KeybindHelp: display session navigator selection shortcuts
Loading
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 37.50% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 24 functions across 6 files. (2 skipped: … Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description check ✅ Passed The description accurately summarizes configurable Ctrl-N and Ctrl-P navigation bindings, preserved behavior, documentation updates, and verification results.
Title check ✅ Passed The title clearly identifies the primary change: configurable Ctrl-N and Ctrl-P keybindings for the session navigator modal.
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.
Full details: Docstring Coverage

Explanation

Docstring coverage is 37.50% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 24 functions across 6 files. (2 skipped: 2 unsupported.)

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

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 adds independently configurable Session Navigator movement bindings, defaults them to Ctrl+P/Ctrl+N, and exposes them through runtime dispatch, help, generated configuration, and documentation.

  • Adds navigator-specific keybinding parsing, conflict validation, and defaults.
  • Applies configured movement bindings before normal and search-focused navigator handling.
  • Rejects printable bindings that would consume search input.
  • Adds regression coverage and updates configuration reference material.

Confidence Score: 5/5

The PR appears safe to merge.

No blocking failure remains; the previously reported printable-binding issue is rejected by current validation, and navigator text commits cannot be preempted by keybinding matching.

Important Files Changed

Filename Overview
src/app/input/modal.rs Dispatches configured navigator movement in both normal and search-focused views while retaining built-in movement and search commands.
src/config/keybinds.rs Adds an independent navigator binding registry and rejects character bindings capable of intercepting searchable text.
src/config/model.rs Adds the two serialized keybinding fields, overlay handling, effective-value copying, and Ctrl+P/Ctrl+N defaults.
src/ui/keybind_help.rs Displays the resolved Session Navigator movement bindings in the navigation help group.
docs/next/website/src/data/config-reference.json Documents both new configuration keys with defaults consistent with the runtime model.

Reviews (3): Last reviewed commit: "docs(changelog): add session navigator m..." | 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
Contributor 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
@ogulcancelik

Copy link
Copy Markdown
Collaborator

@jplew the implementation review is clean. please rebase onto current master, add the user-facing entry to docs/next/CHANGELOG.md, and rerun checks and both review bots.

@jplew
jplew force-pushed the fix/session-navigator-movement-bindings branch from 9fffd06 to dd17fbb Compare August 25, 2026 00:22
@coderabbitai

coderabbitai Bot commented Aug 25, 2026

Copy link
Copy Markdown

Note

GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer.

@jplew

jplew commented Aug 25, 2026

Copy link
Copy Markdown
Contributor Author

Rebased onto current master and added the user-facing entry under Unreleased → Added in docs/next/CHANGELOG.md. No code changes since the reviewed implementation — the rebase applied cleanly with no conflicts (6e8b138d was the only master advance that touched an overlapping file, and only the changelog).

Validation on the new head before pushing: just check green — fmt, clippy -D warnings, full nextest suite, integration-assets and plugin-marketplace tests, Windows-target clippy, and all maintenance script tests.

CI and both bot reviews are re-running on dd17fbb; will confirm once they're complete.

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.

3 participants