Skip to content

fix: repeat copy-mode navigation keys - #2372

Open
ogulcancelik wants to merge 1 commit into
masterfrom
fix/copy-mode-arrow-repeat
Open

fix: repeat copy-mode navigation keys#2372
ogulcancelik wants to merge 1 commit into
masterfrom
fix/copy-mode-arrow-repeat

Conversation

@ogulcancelik

Copy link
Copy Markdown
Collaborator

Summary

  • repeat copy-mode arrow, Page Up/Down, Home, and End input when terminals report explicit repeat events
  • keep confirm, exit, prefix, and other modal actions single-shot
  • preserve input-source ownership with a copy-navigation-specific consumed lease

Reproduction

macOS Ghostty reports held arrows as Kitty Repeat events; Linux Ghostty reports repeated presses. Before this change, the macOS Ghostty → SSH path moved once. The patched build repeats continuously.

Tests

  • just check
  • automated macOS Ghostty → SSH validation: held Up changed copy-mode scroll offset from 0 to 53

Refs #2371

@coderabbitai

coderabbitai Bot commented Aug 5, 2026

Copy link
Copy Markdown

Review Change Stack

Important

Review skipped

No new commits to review since the last review.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: febcae80-81eb-484d-a11d-feaf81e3d2e9

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Copy-mode navigation now supports explicit terminal key-repeat events for arrows, Page Up/Down, Home, and End. Dedicated input leases route these events through copy-mode handling while preserving existing repeat behavior for other keys.

Changes

Copy-navigation repeat handling

Layer / File(s) Summary
Navigation repeat contract and test
src/app/input/copy_mode.rs
AppState permits repeats only for selected navigation keys in copy mode. The test validates repeated arrow movement and cursor clamping.
Repeat lease disposition
src/app/input/lease.rs
ConsumedInputLease records copy-navigation repeats. The lease table identifies these leases and excludes them from generic repeat planning.
Press and repeat event routing
src/app/mod.rs, src/app/runtime.rs, docs/next/CHANGELOG.md
Input routing records copy-navigation leases on key presses and replays repeat events while copy mode remains active. The changelog documents the supported keys.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Terminal
  participant AppState
  participant InputLeaseTable
  participant CopyModeHandler
  Terminal->>AppState: Send key press
  AppState->>InputLeaseTable: Record RepeatCopyNavigation
  Terminal->>AppState: Send KeyEventKind::Repeat
  AppState->>InputLeaseTable: Check copy-navigation lease
  AppState->>CopyModeHandler: Replay navigation repeat_count times
Loading

Possibly related issues

Possibly related PRs

  • herdrdev/herdr#2142 — Provides the input-lease repeat-routing system extended by this change.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
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.
Title check ✅ Passed The title clearly and concisely describes the primary change: repeating navigation keys in copy mode.
Description check ✅ Passed The description directly explains the copy-mode repeat behavior, preserved single-shot actions, input lease handling, reproduction, and tests.
✨ 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 fix/copy-mode-arrow-repeat

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 5, 2026

@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)

1187-1199: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Add coverage for both repeat routers.

This test exercises App::route_client_input, which covers the headless routing path. The PR also changes src/app/runtime.rs, and the allowlist includes PageUp, PageDown, Home, and End. Add one runtime-path test and cases for the remaining allowlisted keys.


ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: e08b7c75-531f-4917-9e1a-26f5e9b923ae

📥 Commits

Reviewing files that changed from the base of the PR and between eb93ec8 and 3638cce.

📒 Files selected for processing (5)
  • docs/next/CHANGELOG.md
  • src/app/input/copy_mode.rs
  • src/app/input/lease.rs
  • src/app/mod.rs
  • src/app/runtime.rs

@ogulcancelik

Copy link
Copy Markdown
Collaborator Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Aug 5, 2026

Copy link
Copy Markdown
⚠️ Action not completed

Already reviewed.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@joonhwan

joonhwan commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Though I'm interested in this fix , when i cargo run this branch, copy mode's keys(i.e : j,k,ctrl-u,ctrl-d ...) cannot be repeated(For Windows herdr test).

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