8000 fix(terminal): keep a Ctrl+click wmux opens from reaching a mouse-tracking app (#353) by jpstratman · Pull Request #354 · amirlehmam/wmux · GitHub
[go: up one dir, main page]

Skip to content

fix(terminal): keep a Ctrl+click wmux opens from reaching a mouse-tracking app (#353) - #354

Merged
amirlehmam merged 1 commit into
amirlehmam:masterfrom
jpstratman:fix/ctrl-click-link-double-open
Oct 25, 2026
Merged

amirlehmam merged 1 commit into
amirlehmam:masterfrom
jpstratman:fix/ctrl-click-link-double-open

Conversation

@jpstratman
@jpstratman jpstratman commented Oct 24, 2026 •
Copy link
Copy Markdown
Contributor

Closes #353

In a pane whose app has turned on mouse tracking, a Ctrl+click on a link now opens it once, in wmux, and the app no longer sees the click. Before, xterm reported the Ctrl+click to the app while wmux opened the link, so an app that opens links on Ctrl+click (seen with Claude Code) opened a second copy in the system browser.

Cause

Since #280, linkClickTarget gives a modified click in a mouse-tracking pane to wmux. But xterm's mousedown reporter only holds back a selection-forcing modifier (Shift, or Alt on macOS), so the press and release still reached the app with the Ctrl bit set (ESC[<16;…M / m).

Design choices

  • Claim only clicks wmux will open. Capture-phase listeners on the terminal container stop the press before xterm sees it, but only when tracking is on, Ctrl/Cmd is held, it's the primary button, and an http(s) link is under the pointer. Plain clicks, clicks off a link, and panes without tracking go through xterm unchanged.
  • The hovered link comes from the providers' hover/leave callbacks. Both link sources (OSC 8 linkHandler and WebLinksAddon) share one hover state, since xterm's current link is private.
  • wmux opens the link on the release. xterm's Linkifier never sees the claimed press, so it wouldn't activate the link. The release is swallowed even if the pointer has left the link, so the app never gets a release without a press.

Verification

Besides the unit tests, I loaded real xterm 6.0.0 in Electron 43 and sent trusted CDP mouse events, with and without the new listeners. Without them, Ctrl+click on a plain URL and on an OSC 8 link opened wmux and also sent the press/release to the app. With them, each opened wmux once and sent nothing to the app. Plain clicks and Ctrl+clicks off a link were still reported the same way in both runs.

I also ran this branch as a side-by-side dev instance (WMUX_INSTANCE) and sent CDP mouse input to its window, with each link pointing at a local page that logs who loads it. When Claude Code 2.1.310 printed a link, Ctrl+click opened it once in the wmux panel and the system browser never requested it. A plain click opened nothing. In a small mouse-tracking test app, Ctrl+click on a link opened it and the app received no report. Plain clicks and Ctrl+clicks off the link still reached the app.

…cking app (amirlehmam#353)

In a pane whose app has mouse tracking on, xterm reported a Ctrl+click on a link to the app while wmux opened the link, so an app that opens links on Ctrl+click opened it a second time in the system browser. Claim the press and release in the capture phase when a link is under the pointer, and open the link on the release.
@amirlehmam
amirlehmam merged commit 41cfeea into amirlehmam:master Oct 25, 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.

bug: Ctrl+click on a link in a mouse-tracking pane opens it in both the wmux panel and the system browser

2 participants

0