diffplug / diffplug/dormouse

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

オープン
#651 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る
主要言語
TypeScript
スター
5
フォーク
0
平均マージ
18時間 32分
マージ済み PR(30日)
216

説明

## 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.

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

調査の方向性

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 のベータ版が更新され、private-state の読み取りが削除され、回帰テストがパスすることです。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
typescript
領域
tooling
issue の種類
バグ
難易度
4/5
見積もり時間
3〜5日
活発さ
活発
明瞭さ
おおむね明確
初心者へのやさしさ
48/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。