fix(web): strip ANSI erase codes and blank-line bursts from PTY stream

Ink two-pass virtual scrolling during session resume floods the
PTY output with \x1b[K (erase-line), \x1b[NX (erase-char), and
thousand-line \n bursts. In the Dashboard INLINE mode, xterm
main scrollback buffer absorbs these as blank rows.

Filter all three in ws.onmessage before they reach xterm.

Refs #47313.
This commit is contained in:
灵越羽毛 2026-06-17 17:51:57 +08:00 committed by Austin Pickett
parent aff380ddbe
commit 4b6e1e440e

View file

@ -990,11 +990,17 @@ export default function ChatPage({ isActive = true }: { isActive?: boolean }) {
};
ws.onmessage = (ev) => {
let text: string;
if (typeof ev.data === "string") {
term.write(ev.data);
text = ev.data;
} else {
term.write(new Uint8Array(ev.data as ArrayBuffer));
text = new TextDecoder().decode(new Uint8Array(ev.data as ArrayBuffer));
}
term.write(
text.replace(/\n{3,}/g, "\n\n")
.replace(/\x1b\[\d*K/g, "")
.replace(/\x1b\[\d*X/g, "")
);
};
ws.onclose = (ev) => {