Skip to content

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

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

fix(input): allow escape as a prefix-mode keybinding#2322
fraidev wants to merge 3 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; 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

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: 387be5fd-2504-4bf8-93a8-f8463b6c2133

📥 Commits

Reviewing files that changed from the base of the PR and between 2c7990b and 199e2eb.

📒 Files selected for processing (4)
  • 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
🚧 Files skipped from review as they are similar to previous changes (4)
  • docs/next/CHANGELOG.md
  • docs/next/website/src/content/docs/zh-cn/configuration.mdx
  • docs/next/website/src/content/docs/configuration.mdx
  • docs/next/website/src/content/docs/ja/configuration.mdx

📝 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 refine Escape cancellation and key-dispatch behavior in src/app/input/navigate.rs.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the primary change: allowing Escape as a prefix-mode keybinding.
Description check ✅ Passed The description accurately explains the Escape binding change and its fallback behavior when unbound.
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 participate in normal prefix-mode binding dispatch while preserving cancellation when it is unbound.

  • Removes the unconditional Escape short-circuit before prefix action resolution.
  • Adds runtime and configuration tests for prefix+esc and prefix+escape.
  • Documents the new behavior in English, Japanese, and Simplified Chinese configuration guides and the changelog.

Confidence Score: 5/5

The PR appears safe to merge.

No blocking failure remains.

Important Files Changed

Filename Overview
src/app/input/navigate.rs Routes Escape through normal prefix binding resolution and retains unmatched-key cancellation, with tests covering bound and unbound behavior.
src/config/keybinds.rs Adds configuration coverage confirming case-insensitive esc and escape aliases resolve to a prefix Escape trigger.
docs/next/website/src/content/docs/configuration.mdx Documents Escape aliases and the distinction between bound action dispatch and unbound cancellation.
docs/next/website/src/content/docs/ja/configuration.mdx Updates the Japanese configuration guide with the new prefix-Escape behavior.
docs/next/website/src/content/docs/zh-cn/configuration.mdx Updates the Simplified Chinese configuration guide with the new prefix-Escape behavior.
docs/next/CHANGELOG.md Records support for Escape as a prefix-mode right-hand-side key.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[Escape pressed in Prefix mode] --> B{Prefix binding matches?}
  B -->|Yes| C[Execute configured action]
  B -->|No| D[Leave Prefix mode]
Loading

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

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