Skip to content

Commit c8655be

Browse files
authored
test(terminal): cover C1 buffer text controls (#103439)
1 parent d72e618 commit c8655be

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

src/gateway/terminal/buffer-text.test.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@ import { describe, expect, it } from "vitest";
22
import { renderTerminalBufferText } from "./buffer-text.js";
33

44
describe("renderTerminalBufferText", () => {
5-
it("strips ANSI color and erase sequences", () => {
5+
it("strips ANSI color and erase sequences in ESC and C1 forms", () => {
66
expect(renderTerminalBufferText("\u001b[32mok\u001b[0m done\u001b[2K")).toBe("ok done");
7+
expect(renderTerminalBufferText("\u009b31mred\u009b0m")).toBe("red");
78
});
89

910
it("collapses carriage-return overwrites to the last write per line", () => {
@@ -18,6 +19,13 @@ describe("renderTerminalBufferText", () => {
1819
expect(renderTerminalBufferText("a\u0007b\tc")).toBe("ab\tc");
1920
});
2021

22+
it("drops the full residual C1 range without clipping adjacent Unicode text", () => {
23+
const c1 = Array.from({ length: 0x20 }, (_, offset) =>
24+
String.fromCharCode(0x80 + offset),
25+
).join("");
26+
expect(renderTerminalBufferText(`a\u007f${c1}\u00a0b\tc`)).toBe("a\u00a0b\tc");
27+
});
28+
2129
it("strips OSC title sequences", () => {
2230
expect(renderTerminalBufferText("\u001b]0;title\u0007prompt$ ")).toBe("prompt$ ");
2331
});

0 commit comments

Comments
 (0)