feat(terminal): natural drag-select + scheme-less clickable links over claude's TUI (v0.190.0)#320
Merged
Merged
Conversation
…r claude's mouse-reporting TUI (v0.192.0) The first-party <Xterm> client strips the app's mouse-*tracking* DECSET modes (1000–1003) out of the PTY output stream before xterm sees them, so a plain drag selects and links are clickable like a web page — no Option-drag. Only the wheel is forwarded back to claude (as SGR events) so its conversation still scrolls. Replaces WebLinksAddon with custom link providers that match bare domains, localhost:port, www, and OSC-8 links (not file.tsx:42). Adds scripts/mouse-tui.mjs + TERMBED_CMD so the test bed can reproduce claude's mouse mode. Verified end-to-end with Playwright against the harness: drag-select, link-click, and wheel all pass. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
ef3f8b4 to
6d4a1f8
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What & why
The browser terminal's selection and links were unnatural: text could only be selected with Option+drag, and links didn't click at all — especially rendered links without a full
https://.Root cause: claude's fullscreen TUI turns on mouse tracking. The moment xterm sees a tracking mode it disables its own selection service and forwards click/drag to the app — hence Option-drag was the only escape, and link clicks got eaten. But claude only ever uses the wheel (it runs with
DISABLE_MOUSE_CLICKS); it discards clicks/drags. The old test bed ran plain bash, which never enables mouse tracking, so it never reproduced this.The rework (web-only — no server/MCP restart)
stripMouseTrackingfilters the app's mouse-tracking DECSET modes (1000–1003) out of the PTY output stream before xterm sees them — so xterm stays in its normal, no-mouse state (plain drag selects, links are clickable like a web page). Everything else (SGR encoding, focus, alt-screen, bracketed paste, …) passes through untouched; split-across-frame sequences are carried. Only the wheel is re-supplied to claude as SGR events (viaattachCustomWheelEventHandler) so its conversation still scrolls. Documented xterm API only — no internals, survives xterm upgrades.makeLinkProviderreplaces the stockWebLinksAddon(fullhttps://…only) with custom providers matching bare domains (example.com), subdomains,www.…,localhost:PORT/127.0.0.1:PORT, and OSC-8 hyperlinks — opening the right target in a new tab, while deliberately not underliningfile.tsx:42-style tokens.Reproducing + validation
scripts/mouse-tui.mjsreproduces claude's mouse-reporting condition;TERMBED_CMD='node …/mouse-tui.mjs' node scripts/termbed.mjspoints the test bed at it.example.comhttps://example.com; ✓localhost:5199→http://…; ✓www.google.com→https://…; ✓ full URL passes throughComponent.tsx:42is not a linknpm run typecheck,cd web && npm run build, andnpm run test:governance(68/68) all green.🤖 Generated with Claude Code