Workspace transfer reads xterm private state because addon-serialize drops mouse encoding

未关闭
#651 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
48/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
活跃
技术栈
typescript
领域
tooling

调研方向

从 lib/src/lib/terminal-transfer.ts 开始,运行 lib/src/lib/terminal-transfer.test.ts 中指定的往返测试,然后阅读 docs/specs/transport.md 和 docs/specs/webgl-text.md,了解传输和版本锁步要求。完成的标准是 addon-serialize 发出鼠标编码,固定的 @xterm beta 版本得到升级,移除私有状态读取,并且回归测试通过。

由索引模型根据 Issue 内容生成。

描述

Problem

When a Workspace moves between standalone windows, each terminal is rebuilt in the target from @xterm/addon-serialize output (serializeTransferTerminal in lib/src/lib/terminal-transfer.ts). The pinned addon (@xterm/addon-serialize 0.15.0-beta.301, with @xterm/xterm 6.1.0-beta.304) serializes the mouse tracking mode (?1000 / ?1002 / ?1003) but not the mouse encoding: SGR (CSI ? 1006 h) or SGR-pixels (CSI ? 1016 h).

Without it, a full-screen program that turned on SGR mouse reporting (vim, tmux, htop, …) arrives in the new window with xterm's default encoding. From then on its mouse reports are misparsed, and clicks past column 223 cannot be encoded at all.

Current workaround (#630)

serializeTransferTerminal reads xterm's private terminal._core.mouseStateService.activeEncoding and appends \x1b[?1006h or \x1b[?1016h after the serialized buffer. docs/specs/transport.md → "Transferring a Workspace" requires the encoding to survive the move, and lib/src/lib/terminal-transfer.test.ts pins it against real xterm parsing:

  • preserves mouse tracking and encoding %i through real xterm parsing
  • does not resurrect encoding after reset %j
  • still transfers the buffer if private mouse state is unavailable

The weakness is the private field. If an xterm bump renames or moves mouseStateService / activeEncoding, the lookup returns nothing and the buffer transfers without the encoding. The round-trip tests would fail that bump rather than let it regress silently, but the code still reaches into xterm internals.

Proposed fix

  1. Upstream: have addon-serialize emit the active mouse encoding alongside the tracking mode (xtermjs/xterm.js, addons/addon-serialize).
  2. Bump the pinned @xterm/* betas, respecting the version lockstep in docs/specs/webgl-text.md.
  3. Delete the private-state read in serializeTransferTerminal; keep the round-trip tests as the regression pin.
主要语言
TypeScript
星标
5
派生
1
平均合并
18 小时 26 分钟
30 天内合并 PR
229

贡献指南

这个仓库没有索引到贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

diffplug/dormouse 的其他 Issue

查看 diffplug/dormouse 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。