fix: honor direct keybindings in copy mode - #2243
Conversation
📝 WalkthroughWalkthroughCopy-mode input handling now prioritizes search prompts and direct bindings, validates modifiers for built-in controls, and routes direct and prefix navigation through shared context-aware execution. Regression tests and a changelog entry document the behavior. ChangesCopy-mode dispatch
Estimated code review effort: 3 (Moderate) | ~25 minutes Sequence Diagram(s)sequenceDiagram
participant App
participant SearchPrompt
participant AppState
participant NavigateAction
App->>SearchPrompt: Check for an active search prompt
alt Search prompt is active
SearchPrompt-->>App: Handle the key
else Search prompt is inactive
App->>AppState: Dispatch direct binding or copy-mode key
AppState->>NavigateAction: Execute action with ActionContext
NavigateAction-->>AppState: Return action result and persistence state
end
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
Greptile SummaryThe PR makes exact direct bindings take precedence over native copy-mode commands while preserving prefix and active search-prompt priority.
Confidence Score: 5/5The PR appears safe to merge with no concrete blocking or non-blocking issues identified. The new Copy-mode dispatch follows the established direct and prefix binding order, retains search-prompt priority, and reuses existing copy-state cancellation and focus synchronization behavior.
|
| Filename | Overview |
|---|---|
| src/app/input/copy_mode.rs | Adds direct-binding dispatch ahead of native copy commands, exact modifier handling, and focused regression tests without an identified defect. |
| src/app/input/navigate.rs | Generalizes the existing prefix copy-state lifecycle helper for direct actions while retaining synchronization and cancellation rules. |
| docs/next/CHANGELOG.md | Accurately documents the direct-binding precedence and exact-modifier behavior. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart TD
K[Key received in Copy mode] --> P{Prefix key?}
P -->|Yes| Prefix[Enter Prefix mode]
P -->|No| S{Search prompt active?}
S -->|Yes| Native[Handle copy-mode prompt/native key]
S -->|No| N{Exact direct non-indexed action?}
N -->|Yes| Action[Execute copy-mode-aware action]
N -->|No| C{Exact direct custom command?}
C -->|Yes| Command[Cancel Copy mode and launch command]
C -->|No| I{Exact direct indexed action?}
I -->|Yes| Action
I -->|No| Native
Reviews (1): Last reviewed commit: "fix: honor direct keybindings in copy mo..." | Re-trigger Greptile
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/app/input/copy_mode.rs (1)
13-55: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winConsider consolidating the direct-binding resolution order with
terminal.rs.
App::handle_copy_mode_keyre-implements the same three-step priority check (terminal_direct_non_indexed_navigation_action->command_for_key->terminal_direct_indexed_navigation_action) already present interminal.rs'sprepare_terminal_key_forward. Both call sites must stay in the same order for direct bindings to behave consistently, and this PR exists specifically because of an ordering/priority defect. A shared helper innavigate.rsthat returns which category matched (if any) would let both call sites consume one authoritative ordering instead of two hand-maintained copies, reducing the risk that a future change updates one call site but not the other.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 7f632b86-5927-4e4b-bfa8-88f29b92719c
📒 Files selected for processing (3)
docs/next/CHANGELOG.mdsrc/app/input/copy_mode.rssrc/app/input/navigate.rs
|
Re CodeRabbit review 4847025466: keeping the resolver sequence local. The three match categories require different mode-specific execution and copy-state handling, so a shared result enum would add coupling without removing that branching; focused tests cover the ordering and each category. |
|
@akbash-bot Please close this PR without merging, then close #2242 as expected behavior. Copy mode intentionally owns direct input; only the configured prefix remains available for normal Herdr actions. Supporting direct bindings or a separate navigation policy in copy mode requires broader product decisions, especially around preserving selections and dormant copy state. Please explain this briefly and kindly on the issue, remove the |
|
Closing without merge. Copy mode intentionally owns direct input; supporting broader direct bindings requires product design around command conflicts, selection preservation, and dormant copy state. |
Summary
Checks
cargo test app::input::copy_mode::tests(45 passed)just ci 'all() & not binary(live_handoff)'(3164 passed; integration and marketplace tests passed)just windows-lintjust checkreached an unrelated Kennel harness incompatibility:tests/live_handoff.rsonly recognizes<checkout>/target/debug/herdr, while Kennel requires an external issue-localCARGO_TARGET_DIR; server logs confirmed the replacement handoff process startedrefs #2242