Skip to content

fix(input): preserve mouse forwarding through handoff - #3002

Merged
ogulcancelik merged 1 commit into
masterfrom
akbash/3000-preserve-handoff-mouse
Aug 19, 2026
Merged

fix(input): preserve mouse forwarding through handoff#3002
ogulcancelik merged 1 commit into
masterfrom
akbash/3000-preserve-handoff-mouse

Conversation

@akbash-bot

Copy link
Copy Markdown
Collaborator

Issue

After a live handoff, mouse-aware applications that remain running stop receiving clicks and wheel events until they restart.

Problem

The replacement server restored the pane's recorded mouse modes for routing decisions, but not the matching encoder state used to turn mouse actions into terminal input. Herdr therefore routed wheel events to the pane and then failed to encode them.

How did we fix it?

Handoff reconstruction now restores mouse mode and encoding through the terminal emulator's existing control-sequence parser. This keeps routing and encoding synchronized within each imported pane without sending anything to the running pane process.

Verification

Before the fix, restoring ButtonMotion with SGR encoding made a wheel event return no bytes. After the fix, the same production path emits ESC[<64;12;10M; handoff state capture and existing mouse encoding tests also pass. just check completed formatting, clippy, and 3,481 tests; its one remaining live-handoff PID-discovery failure reproduces unchanged against the base implementation.

refs #3000

@coderabbitai

coderabbitai Bot commented Aug 19, 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: 147f0b6b-abe4-471e-9d28-a4048231a840

📥 Commits

Reviewing files that changed from the base of the PR and between 4ace235 and 80fe1fe.

📒 Files selected for processing (2)
  • docs/next/CHANGELOG.md
  • src/pane/terminal.rs

Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.


📝 Walkthrough

Walkthrough

Live handoff now restores mouse tracking and encoding through terminal escape sequences. The handoff test verifies SGR mouse-wheel encoding. The changelog documents the fix.

Changes

Mouse Handoff

Layer / File(s) Summary
Restore and validate mouse state
src/pane/terminal.rs, docs/next/CHANGELOG.md
seed_handoff_input_state restores mouse protocol and encoding through ANSI sequences. The test verifies SGR scroll encoding. The changelog records the live-handoff fix.

Estimated code review effort: 2 (Simple) | ~10 minutes

Merge Risk: ⚪ Minimal · up to 80fe1

This localized change restores mouse-event forwarding across handoff, with no actionable merge-blocking risk remaining after normal checks and review.

Possibly related issues

Possibly related PRs

  • herdrdev/herdr#2285: Both changes restore terminal mouse tracking and encoding across reconnect or handoff paths.
  • herdrdev/herdr#2523: Both changes preserve mouse-reporting state, including SGR encoding, during terminal or pane handoff.
  • herdrdev/herdr#2312: Both changes modify terminal mouse-input handling in related code paths.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely identifies the main change: preserving mouse forwarding through live handoff.
Description check ✅ Passed The description directly explains the mouse forwarding issue, the fix, and its verification.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
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/3000-preserve-handoff-mouse

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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 19, 2026
@ogulcancelik
ogulcancelik merged commit 52960ea into master Aug 19, 2026
7 checks passed
@kangal-bot kangal-bot removed the ai-review Trigger automated AI reviews for pull requests admitted by the PR gate label Aug 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants