Skip to content

fix: honor direct keybindings in copy mode - #2243

Closed
akbash-bot wants to merge 1 commit into
masterfrom
akbash/2242-copy-mode-direct-bindings
Closed

fix: honor direct keybindings in copy mode#2243
akbash-bot wants to merge 1 commit into
masterfrom
akbash/2242-copy-mode-direct-bindings

Conversation

@akbash-bot

Copy link
Copy Markdown
Collaborator

Summary

  • dispatch exact direct action, custom-command, and indexed bindings before native copy-mode commands
  • preserve prefix and copy-search prompt priority while reusing existing copy-state lifecycle rules
  • require exact modifiers for native copy-mode special and Ctrl-page commands

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-lint
  • maintenance unittest suite (93 passed)
  • full just check reached an unrelated Kennel harness incompatibility: tests/live_handoff.rs only recognizes <checkout>/target/debug/herdr, while Kennel requires an external issue-local CARGO_TARGET_DIR; server logs confirmed the replacement handoff process started

refs #2242

@coderabbitai

coderabbitai Bot commented Aug 3, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

Copy-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.

Changes

Copy-mode dispatch

Layer / File(s) Summary
Shared copy-mode action dispatch
src/app/input/navigate.rs
Prefix and direct navigation actions use shared context-aware handling for execution, cancellation, TUI dispatch, and copy-mode persistence.
Direct key handling and validation
src/app/input/copy_mode.rs, docs/next/CHANGELOG.md
Search prompts take priority. Direct bindings execute before normal copy-mode handling. Bare controls require no modifiers, and Ctrl paging requires exactly Ctrl. Regression tests and changelog text cover the updated behavior.

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
Loading
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the main change: direct keybindings now work in copy mode.
Description check ✅ Passed The description accurately summarizes the copy-mode dispatch changes and reports relevant validation results.
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 docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch akbash/2242-copy-mode-direct-bindings

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 3, 2026
@greptile-apps

greptile-apps Bot commented Aug 3, 2026

Copy link
Copy Markdown

Greptile Summary

The PR makes exact direct bindings take precedence over native copy-mode commands while preserving prefix and active search-prompt priority.

  • Routes direct non-indexed actions, custom commands, and indexed actions through existing copy-mode lifecycle handling.
  • Requires exact modifiers for native special-key and Ctrl-page copy-mode commands.
  • Adds coverage for direct pane focus, splitting, custom commands, indexed tab switching, search-prompt priority, and modifier matching.

Confidence Score: 5/5

The 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.

Important Files Changed

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
Loading

Reviews (1): Last reviewed commit: "fix: honor direct keybindings in copy mo..." | Re-trigger Greptile

@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/copy_mode.rs (1)

13-55: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Consider consolidating the direct-binding resolution order with terminal.rs.

App::handle_copy_mode_key re-implements the same three-step priority check (terminal_direct_non_indexed_navigation_action -> command_for_key -> terminal_direct_indexed_navigation_action) already present in terminal.rs's prepare_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 in navigate.rs that 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

📥 Commits

Reviewing files that changed from the base of the PR and between eacea2d and aa3d29c.

📒 Files selected for processing (3)
  • docs/next/CHANGELOG.md
  • src/app/input/copy_mode.rs
  • src/app/input/navigate.rs

@akbash-bot

Copy link
Copy Markdown
Collaborator Author

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.

@ogulcancelik

Copy link
Copy Markdown
Collaborator

@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 bug label, apply expected-behavior, and invite the reporter to open an Ideas discussion describing their desired workflow so we can triage it properly. Do not open a replacement PR.

@akbash-bot

Copy link
Copy Markdown
Collaborator Author

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.

@akbash-bot akbash-bot closed this Aug 3, 2026
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