Skip to content

fix(input): allow escape as a prefix-mode keybinding - #2322

Open
fraidev wants to merge 5 commits into
herdrdev:masterfrom
fraidev:fix/prefix-escape-keybind
Open

fix(input): allow escape as a prefix-mode keybinding#2322
fraidev wants to merge 5 commits into
herdrdev:masterfrom
fraidev:fix/prefix-escape-keybind

Conversation

@fraidev

@fraidev fraidev commented Aug 4, 2026

Copy link
Copy Markdown

Hey!

Esc always canceled prefix mode before keybinds ran, so copy_mode = "prefix+esc" (like tmux bind Escape copy-mode) never worked even though the config accepted it.

This treats Esc as a normal prefix RHS when bound, and unbound Esc still cancels prefix mode.

Happy to adjust anything if needed.

Prefix mode always canceled on Esc before binding lookup, so configs like
copy_mode = "prefix+esc" (tmux bind Escape copy-mode) never ran. Unbound
Esc still cancels prefix mode via the unmatched-key path.
@coderabbitai

coderabbitai Bot commented Aug 4, 2026

Copy link
Copy Markdown

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

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: ca3c8f27-c8fd-4bb1-b7c7-252acd1c1019

📥 Commits

Reviewing files that changed from the base of the PR and between 5109336 and 0720b4a.

📒 Files selected for processing (6)
  • docs/next/CHANGELOG.md
  • docs/next/website/src/content/docs/configuration.mdx
  • docs/next/website/src/content/docs/ja/configuration.mdx
  • docs/next/website/src/content/docs/zh-cn/configuration.mdx
  • src/app/input/navigate.rs
  • src/config/keybinds.rs
🚧 Files skipped from review as they are similar to previous changes (6)
  • docs/next/CHANGELOG.md
  • docs/next/website/src/content/docs/configuration.mdx
  • docs/next/website/src/content/docs/zh-cn/configuration.mdx
  • src/config/keybinds.rs
  • docs/next/website/src/content/docs/ja/configuration.mdx
  • src/app/input/navigate.rs

📝 Walkthrough

Walkthrough

Escape now supports configured prefix-mode bindings through esc or escape. Unbound Escape still exits prefix mode. Tests cover parsing, dispatch, fallback behavior, and copy-mode entry. Documentation describes the updated behavior in English, Japanese, and Chinese.

Changes

Escape prefix bindings

Layer / File(s) Summary
Escape key alias parsing
src/config/keybinds.rs
Tests verify case-insensitive esc and escape aliases for prefix bindings.
Prefix dispatch and fallback
src/app/input/navigate.rs
Prefix handling dispatches configured Escape bindings before using unbound Escape to exit prefix mode. Tests cover copy-mode entry and cancellation.
Documented Escape behavior
docs/next/CHANGELOG.md, docs/next/website/src/content/docs/*/configuration.mdx
The changelog and configuration guides document Escape aliases, prefix bindings, and fallback behavior.

Estimated code review effort: 2 (Simple) | ~10 minutes

Sequence Diagram(s)

sequenceDiagram
  participant User
  participant PrefixMode
  participant KeybindingResolver
  participant CopyMode
  User->>PrefixMode: Press prefix then Escape
  PrefixMode->>KeybindingResolver: Resolve configured Escape binding
  KeybindingResolver->>CopyMode: Execute copy-mode action
  PrefixMode-->>User: Exit prefix mode when Escape is unbound
Loading

Possibly related PRs

  • herdrdev/herdr#2340: Both PRs modify Escape or control-key cancellation behavior and tests in src/app/input/navigate.rs.
  • herdrdev/herdr#2558: Both PRs modify keybinding dispatch and tests in src/app/input/navigate.rs and src/config/keybinds.rs.
  • herdrdev/herdr#2676: Both PRs modify prefix-key dispatch and related keybinding tests.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes enabling Escape as a prefix-mode keybinding.
Description check ✅ Passed The description accurately explains the previous behavior and the new bound and unbound Escape behavior.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

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

greptile-apps Bot commented Aug 4, 2026

Copy link
Copy Markdown

Greptile Summary

This PR allows Escape to act as a configured prefix-mode key while preserving cancellation for unbound Escape.

  • Routes Escape through normal prefix binding resolution before falling back to leaving prefix mode.
  • Adds parsing and dispatch coverage for both prefix+esc and prefix+escape.
  • Documents the behavior in the changelog and configuration guides.

Confidence Score: 5/5

The PR appears safe to merge.

No blocking failure remains.

Important Files Changed

Filename Overview
src/app/input/navigate.rs Removes unconditional Escape cancellation so configured prefix bindings execute, while unmatched Escape still exits prefix mode; tests cover bound and unbound behavior.
src/config/keybinds.rs Adds tests confirming the supported Escape aliases parse into the expected prefix trigger without diagnostics.
docs/next/website/src/content/docs/configuration.mdx Documents Escape aliases and the distinction between bound prefix behavior and unbound cancellation.

Reviews (4): Last reviewed commit: "Merge branch 'master' into fix/prefix-es..." | Re-trigger Greptile

@fraidev

fraidev commented Aug 11, 2026

Copy link
Copy Markdown
Author

Hey @ogulcancelik, could you take a look at this? I’m using a fork for now because I’m really used to this keybind in tmux.

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