fix(tui): preserve cached leading diff blanks

This commit is contained in:
can1357
2026-07-14 18:09:46 +02:00
parent 9b1ecbf988
commit fe08c97583
2 changed files with 16 additions and 1 deletions
@@ -219,4 +219,19 @@ describe("transcript streaming commit (assistant text)", () => {
expect(codeRow).toBeGreaterThanOrEqual(0);
expect(rows.slice(codeRow, codeRow + 3)).toEqual([" +a", "", " +streaming"]);
});
it("does not duplicate a leading blank row when the streamed diff grows", () => {
const block = new StreamingMarkdownBlock();
block.setStreamingText("```diff\n\n+partial");
block.render(40);
block.setStreamingText("```diff\n\n+done\n-streaming");
const rows = block.render(40).map(row => Bun.stripANSI(row).trimEnd());
const fenceRow = rows.indexOf("```diff");
expect(fenceRow).toBeGreaterThanOrEqual(0);
expect(rows.slice(fenceRow, fenceRow + 5)).toEqual(["```diff", "", " +done", " -streaming", "```"]);
});
});