fix: suppress terminal query response leaks
This commit is contained in:
@@ -978,6 +978,23 @@ describe("subscribe", () => {
|
||||
|
||||
expect(messages.length).toBe(0);
|
||||
});
|
||||
|
||||
it("does not answer terminal identity queries from the headless snapshot parser", async () => {
|
||||
const session = trackSession(
|
||||
await createTerminal({
|
||||
cwd: "/tmp",
|
||||
shell: "/bin/sh",
|
||||
env: { PS1: "$ " },
|
||||
}),
|
||||
);
|
||||
|
||||
await waitForLines(session, ["$"]);
|
||||
|
||||
session.send({ type: "input", data: "printf '\\033[c'; echo after-da\r" });
|
||||
await waitForState(session, (state) => getLines(state).join("\n").includes("after-da"));
|
||||
|
||||
expect(getLines(session.getState()).join("\n")).not.toContain("62;4;22c");
|
||||
});
|
||||
});
|
||||
|
||||
describe("stream snapshots", () => {
|
||||
|
||||
@@ -657,15 +657,6 @@ export async function createTerminal(options: CreateTerminalOptions): Promise<Te
|
||||
}
|
||||
emitTitleChange(initialTitle);
|
||||
|
||||
// Respond to DA1 queries (CSI c or CSI 0 c) — apps like nvim query terminal capabilities
|
||||
terminal.parser.registerCsiHandler({ final: "c" }, (params) => {
|
||||
if (params.length === 0 || (params.length === 1 && params[0] === 0)) {
|
||||
ptyProcess.write("\x1b[?62;4;22c");
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
});
|
||||
|
||||
let disposeTitleChangeSubscription: { dispose(): void } | null = null;
|
||||
if (!lockedTitle) {
|
||||
disposeTitleChangeSubscription = terminal.onTitleChange((nextTitle) => {
|
||||
|
||||
Reference in New Issue
Block a user