fix(input): allow escape as a prefix-mode keybinding - #2322
Conversation
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.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (4)
🚧 Files skipped from review as they are similar to previous changes (4)
📝 WalkthroughWalkthroughEscape now supports configured prefix-mode bindings through ChangesEscape prefix bindings
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
Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
Greptile SummaryThis PR allows Escape to participate in normal prefix-mode binding dispatch while preserving cancellation when it is unbound.
Confidence Score: 5/5The PR appears safe to merge. No blocking failure remains.
|
| 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]
Reviews (2): Last reviewed commit: "Merge branch 'master' into fix/prefix-es..." | Re-trigger Greptile
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.