Skip to content

fix: finalize stuck terminal drags released outside the iframe#157

Merged
nedtwigg merged 4 commits into
mainfrom
dnd-hiccup
Jun 19, 2026
Merged

fix: finalize stuck terminal drags released outside the iframe#157
nedtwigg merged 4 commits into
mainfrom
dnd-hiccup

Conversation

@nedtwigg

Copy link
Copy Markdown
Member

Summary

Fixes terminal drag selections that get stuck when the mouse button is released outside the iframe, plus a couple of Windows dogfood fixes.

  • Capture the mouse pointer so an outside-iframe drag release finalizes immediately rather than leaving the terminal in a dragging state.
  • Finalize a stuck terminal drag when the button is released outside the iframe (fallback path).
  • Silence VS Code CLI deprecation warnings in dogfood.
  • Make pnpm dogfood:vscode work on Windows.

Test plan

  • New unit tests in terminal-mouse-router.test.ts cover the outside-iframe release finalization.
  • pnpm dogfood:vscode verified on Windows.

🤖 Generated with Claude Code

nedtwigg and others added 4 commits June 19, 2026 12:18
The dogfood script chained commands with `;`, but pnpm runs scripts
through cmd.exe on Windows, where `;` is not a command separator. As a
result `pnpm package` never ran, no .vsix was built, and the install
failed with ENOENT. The `>/dev/null` redirect also errored under cmd.

Convert the script to a cross-platform Node script (matching the repo's
scripts/*.mjs convention) that uninstalls the legacy extension, packages,
installs, cleans up the .vsix, and prints the reload reminder.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The `code` CLI emits internal Node deprecation warnings (e.g. DEP0169
for url.parse) during install. Set NODE_NO_WARNINGS for the code
invocations so dogfood output stays focused.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…de the iframe

A mouse drag is kept alive only by the window 'mouseup'. When the button
is released outside our iframe, that mouseup goes to the host document and
never reaches us, leaving the drag stuck. Treat the next zero-button
mousemove (e.g. when the pointer re-enters) as the mouseup we missed and
finalize the drag in place.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…ze at once

Layer pointer capture on top of the window-mousemove heal. On a left-button
mouse press over terminal-owned content, setPointerCapture so Chromium keeps
delivering the captured pointerup across the iframe boundary even when the
button is released over the host page. We then finalize the drag the instant
it ends rather than waiting for the cursor to re-enter.

The pointerup finalize is deferred one macrotask: for an inside release the
compatibility mouseup follows in the same task and finalizes through the
existing path (preserving the xterm-report / temporary-override timing),
cancelling the deferred finalize. Only an outside release, which produces no
such mouseup, falls through to it. Engines that don't honor cross-frame
capture get no captured pointerup and still rely on the heal.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying mouseterm with  Cloudflare Pages  Cloudflare Pages

Latest commit: 39923a0
Status: ✅  Deploy successful!
Preview URL: https://80022968.mouseterm.pages.dev
Branch Preview URL: https://dnd-hiccup.mouseterm.pages.dev

View logs

@nedtwigg nedtwigg merged commit 9baf399 into main Jun 19, 2026
9 checks passed
@nedtwigg nedtwigg deleted the dnd-hiccup branch June 19, 2026 20:15
@nedtwigg nedtwigg restored the dnd-hiccup branch June 19, 2026 22:48
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.

2 participants