coder / coder/code-server

Terminal loses text selection whenever a TUI enables mouse reporting — no way to opt out in the browser

未關閉
#7,938 3 則留言 2 個 reaction 已指派 0 人 在 GitHub 檢視
bug code-server needs-investigation
主要語言
TypeScript
星號
79.3k
分支
6.8k
平均合併
2 天 6 小時
30 天內合併 PR
41

描述

### What happens

Any TUI that enables mouse reporting (`CSI ? 1000 h`) takes the click away from xterm.js, so a plain drag in the terminal no longer creates a selection. On the desktop that is annoying; in `code-server` it removes the last reliable path to the OS clipboard, because the DOM selection is what the browser's own copy relies on — the VS Code copy commands go through an async IPC hop that loses the clipboard user-gesture.

Concretely: with a full-screen TUI running (e.g. Claude Code with `tui: fullscreen`), users cannot copy terminal text out of the browser at all, unless they know that `Shift`+drag forces a selection.

### Measured

Loaded the exact `@xterm/xterm` build shipped by code-server (6.1.0-beta.291) standalone and drove it with real mouse events:

| Mouse tracking armed | plain drag | `Shift` + drag |
|---|---|---|
| none | selection | selection |
| `?1000h ?1006h` | nothing | selection |
| `?1000h ?1002h ?1003h ?1006h` | nothing | selection |

### Ask

xterm.js already has the option that solves this — `mouseEventsRequireAlt`, which keeps tracking armed but only claims the click while a modifier is held. It is not referenced anywhere in the VS Code build that code-server ships, so it stays at its default.

I have opened an upstream request for VS Code to expose it as a terminal setting: https://github.com/microsoft/vscode/issues/330052. Filing here as well because the browser case is materially worse than the desktop one, and because code-server may want to set the option (or surface a preference) ahead of upstream.

At minimum, documenting `Shift`+drag as the escape hatch in the terminal FAQ would already help.

貢獻指南

開啟貢獻指南

研究方向

Start by tracing the code-server terminal integration and its use of the shipped @xterm/xterm 6.1.0-beta.291 build, then compare how mouseEventsRequireAlt could be configured. Check the terminal FAQ for the Shift+drag escape hatch. Done means browser users can preserve terminal selection while mouse reporting remains available, or the limitation and workaround are documented.

由索引模型根據 Issue 內容生成。

評估

技術堆疊
typescript, vscode
領域
developer-experience, frontend, web-dev
Issue 類型
功能
難度
4/5
預估耗時
3-5 天
活躍度
活躍
描述清晰度
基本清楚
新手友好度
48/100

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。