From 4b6e1e440e966d2b91c83a12359f7db04e934f8f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=81=B5=E8=B6=8A=E7=BE=BD=E6=AF=9B?= <97326386+Icather@users.noreply.github.com> Date: Wed, 17 Jun 2026 17:51:57 +0800 Subject: [PATCH] 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. --- web/src/pages/ChatPage.tsx | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/web/src/pages/ChatPage.tsx b/web/src/pages/ChatPage.tsx index 81b6b30751d..ee1c8944655 100644 --- a/web/src/pages/ChatPage.tsx +++ b/web/src/pages/ChatPage.tsx @@ -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) => {