fix(cli): preserved carriage-return progress boundaries

Normalized lone carriage returns before terminal output is buffered while retaining CRLF as a single line boundary across chunk splits.

Fixes #5845
This commit is contained in:
roboomp
2026-07-17 13:58:23 +00:00
parent 0f9fceeea4
commit e5f65fcd5f
3 changed files with 56 additions and 1 deletions
@@ -227,6 +227,20 @@ describe("OutputSink", () => {
expect(chunks).toEqual(["abc", "def"]);
});
test("normalizes carriage-return progress frames across chunk boundaries", async () => {
const chunks: string[] = [];
const sink = new OutputSink({ onChunk: chunk => chunks.push(chunk) });
sink.push("start\r");
sink.push("one\r");
sink.push("two\r");
sink.push("\n");
const dumped = await sink.dump();
expect(chunks.join("")).toBe("start\none\ntwo\n");
expect(dumped.output).toBe("start\none\ntwo\n");
});
test("preserves SIXEL chunks when passthrough gates are enabled", async () => {
const sixel = "\x1bPqabc\x1b\\";
Bun.env.PI_FORCE_IMAGE_PROTOCOL = "sixel";