Skip to content

fix: suppress motion reports during a cmd-clicked link drag (follow-up to #74) - #75

Merged
austinywang merged 1 commit into
mainfrom
fix-5128-cmd-click-press-leak
Jun 5, 2026
Merged

austinywang merged 1 commit into
mainfrom
fix-5128-cmd-click-press-leak

Conversation

@austinywang

@austinywang austinywang commented Jun 5, 2026 •

Copy link
Copy Markdown

Final follow-up to #71/#74 for manaflow-ai/cmux#5128.

#71 made Cmd-click open links under mouse reporting; #74 stopped the press/release of that click from leaking to a mouse-grabbing alt-screen TUI by suppressing the report whenever the ctrl/super link chord is held. This closes the last leak path: cursorPosCallback still emitted .motion reports while a button was held during the chord (it sees click_state == .press), so a slight drag during link activation leaked button-motion to the program.

Mirror the existing shift "grab override" for the ctrl/super chord in the motion-report path — suppressing only while a button is pressed, so pure movement reports are unaffected. With this, the link-activation chord suppresses the whole click+drag (press, release, and motion) consistently, matching iTerm2 / macOS Terminal.

zig fmt/ast-check clean. Behavior is integration-level (live Surface + mouse-reporting program), verified by cmux dogfood.


AI disclosure (per AI_POLICY.md): developed with Claude Code (Claude Opus 4.8); reviewed by a maintainer.


View with Codesmith Autofix with Codesmith
Need help on this PR? Tag /codesmith with what you need. Autofix is disabled.


Summary by cubic

Prevent button-motion events from leaking to mouse-grabbing programs when cmd/super-clicking a link and dragging. The link-activation chord now suppresses press, release, and motion consistently, closing the last leak in manaflow-ai/cmux#5128.

  • Bug Fixes
    • In cursorPosCallback, suppress motion while a button is pressed and the ctrl/super chord is held (mirrors the shift override). Pure movement without a pressed button is unaffected.

Written for commit 76ead3e. Summary will update on new commits.

Review in cubic

Review follow-up (codex P2 on cmux ghostty-org#5128). mouseButtonCallback suppresses the
press and release of a ctrl/super-chord link click, but cursorPosCallback still
emitted .motion reports while the button was held (click_state == .press), so a
slight drag during link activation leaked button-motion to a mouse-grabbing
program. Mirror the existing shift "grab override" for the ctrl/super chord in
the motion-report path — suppressing only while a button is pressed so pure
movement reports are unaffected. Completes the click+drag suppression across
press, release, and motion for the link chord.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Jun 5, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@austinywang, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 39 minutes and 59 seconds. Learn how PR review limits work.

Your organization has run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: e3137aba-1add-4397-9e0f-2b718985d0c4

📥 Commits

Reviewing files that changed from the base of the PR and between 7850d70 and 76ead3e.

📒 Files selected for processing (1)
  • src/Surface.zig
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix-5128-cmd-click-press-leak

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 and usage tips.

@greptile-apps

greptile-apps Bot commented Jun 5, 2026

Copy link
Copy Markdown

Greptile Summary

This PR closes the last leak path from the ctrl/super link-activation chord by suppressing button-motion reports in cursorPosCallback while a mouse button is pressed during the chord — matching the existing shift "grab override" pattern that was already in place for shift-suppressed captures.

  • Adds a 12-line guard in cursorPosCallback immediately after the analogous shift override: if self.mouse.mods exactly equals the ctrl/super chord and any button is not in the .release state, the motion report is suppressed via break :report.
  • The check is intentionally unconditional (no mouseShiftCapture equivalent), consistent with the matching mouseButtonCallback check from fix: suppress mouse reporting for the full cmd-clicked link click (follow-up to #71) #74 and mouseLinkRefreshAllowedState, both of which also suppress unconditionally for the ctrl/super chord.

Confidence Score: 5/5

Safe to merge — the change is a surgical 12-line addition that closes a well-defined motion-report leak with no side-effects on unrelated code paths.

The guard mirrors the existing shift override character-for-character, uses self.mouse.mods that is already updated at the top of cursorPosCallback before this block runs, and is consistent with the unconditional ctrl/super suppression in mouseButtonCallback and mouseLinkRefreshAllowedState. Pure movement (no button held) is explicitly unaffected, and no existing behavior is touched.

No files require special attention.

Important Files Changed

Filename Overview
src/Surface.zig Adds a motion-suppression guard in cursorPosCallback for the ctrl/super chord — 12 lines mirroring the existing shift override exactly; logic, placement, and mod-comparison are consistent with the rest of the file.

Sequence Diagram

sequenceDiagram
    participant User
    participant Surface
    participant TUI as Mouse-grabbing TUI

    Note over User,TUI: Before this fix (ctrl/super held + button drag)
    User->>Surface: mouseButtonCallback (press, ctrl/super)
    Surface-->>TUI: "suppressed by #74"
    User->>Surface: cursorPosCallback (drag, button held)
    Surface->>TUI: motion report LEAKED

    Note over User,TUI: After this fix
    User->>Surface: mouseButtonCallback (press, ctrl/super)
    Surface-->>TUI: "suppressed (#74)"
    User->>Surface: cursorPosCallback (drag, button held, ctrl/super)
    Note over Surface: mods.equal(ctrlOrSuper) AND any state != .release
    Surface-->>TUI: suppressed (this PR)
    User->>Surface: cursorPosCallback (pure movement, no button held)
    Surface->>TUI: motion report sent (unaffected)
    User->>Surface: mouseButtonCallback (release, ctrl/super)
    Surface-->>TUI: "suppressed (#74)"
Loading

Reviews (1): Last reviewed commit: "fix: also suppress motion reports during..." | Re-trigger Greptile

@austinywang
austinywang merged commit cbba148 into main Jun 5, 2026
153 checks passed
austinywang added a commit that referenced this pull request Jun 5, 2026
…mux ghostty-org#5128)

Final review follow-up to #71/#74/#75: scopes the link-chord click/drag suppression to the left button and clears stale link hover when the chord drops via cursor mods. Merge commit keeps f241952 an ancestor of fork main.
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.

1 participant