From 81301474265fbe3b0a798d519b71ffc31e6d255d Mon Sep 17 00:00:00 2001 From: Dominic <33105147+DAnaeto@users.noreply.github.com> Date: Sun, 1 Nov 2026 05:04:25 -0500 Subject: [PATCH] fix(app): stop the terminal from typing its version reply into the shell (#8419) The browser terminal is a renderer and leaves protocol replies to the daemon, but it still answered XTVERSION (CSI > q) and DECRQSS (DCS $ q ... ST). Those replies went out through onData as if the user had typed them, so a query from a program in the shell left text like ">|xterm.js(6.1.0-beta.292)" on the next input line. Both queries are now swallowed with the other protocol queries. Fixes #8111 --- .../terminal/runtime/terminal-emulator-runtime.browser.test.ts | 2 ++ packages/app/src/terminal/runtime/terminal-emulator-runtime.ts | 2 ++ 2 files changed, 4 insertions(+) diff --git a/packages/app/src/terminal/runtime/terminal-emulator-runtime.browser.test.ts b/packages/app/src/terminal/runtime/terminal-emulator-runtime.browser.test.ts index 3b58c54376..bf044237b0 100644 --- a/packages/app/src/terminal/runtime/terminal-emulator-runtime.browser.test.ts +++ b/packages/app/src/terminal/runtime/terminal-emulator-runtime.browser.test.ts @@ -717,11 +717,13 @@ describe("terminal emulator runtime in a real browser", () => { { name: "DA1-zero", bytes: "\x1b[0c" }, { name: "DA2", bytes: "\x1b[>c" }, { name: "DA3", bytes: "\x1b[=c" }, + { name: "XTVERSION", bytes: "\x1b[>q" }, { name: "DSR-5", bytes: "\x1b[5n" }, { name: "DSR-6", bytes: "\x1b[6n" }, { name: "DSR-?6", bytes: "\x1b[?6n" }, { name: "DECRQM", bytes: "\x1b[1$p" }, { name: "DECRQM-?", bytes: "\x1b[?1$p" }, + { name: "DECRQSS", bytes: "\x1bP$qm\x1b\\" }, { name: "OSC-10-foreground-color", bytes: "\x1b]10;?\x07" }, { name: "OSC-11-background-color", bytes: "\x1b]11;?\x07" }, { name: "OSC-12-cursor-color", bytes: "\x1b]12;?\x07" }, diff --git a/packages/app/src/terminal/runtime/terminal-emulator-runtime.ts b/packages/app/src/terminal/runtime/terminal-emulator-runtime.ts index 05cf0182d1..b1cab84d0e 100644 --- a/packages/app/src/terminal/runtime/terminal-emulator-runtime.ts +++ b/packages/app/src/terminal/runtime/terminal-emulator-runtime.ts @@ -647,6 +647,7 @@ export class TerminalEmulatorRuntime { terminal.parser.registerCsiHandler({ final: "c" }, () => true); terminal.parser.registerCsiHandler({ prefix: ">", final: "c" }, () => true); terminal.parser.registerCsiHandler({ prefix: "=", final: "c" }, () => true); + terminal.parser.registerCsiHandler({ prefix: ">", final: "q" }, () => true); terminal.parser.registerCsiHandler({ final: "n" }, () => true); terminal.parser.registerCsiHandler({ prefix: "?", final: "n" }, () => true); terminal.parser.registerCsiHandler({ final: "R" }, () => true); @@ -655,6 +656,7 @@ export class TerminalEmulatorRuntime { { prefix: "?", intermediates: "$", final: "p" }, () => true, ); + terminal.parser.registerDcsHandler({ intermediates: "$", final: "q" }, () => true); for (const code of [10, 11, 12]) { terminal.parser.registerOscHandler(code, (data) => data.trim() === "?"); }