fix(coding-agent): stabilize user message OSC 133 padding closes #3090

This commit is contained in:
Mario Zechner
2026-04-17 00:22:39 +02:00
parent 624a7f794f
commit b0490310c3
3 changed files with 35 additions and 7 deletions

View File

@@ -0,0 +1,25 @@
import { describe, expect, test } from "vitest";
import { UserMessageComponent } from "../src/modes/interactive/components/user-message.js";
import { initTheme } from "../src/modes/interactive/theme/theme.js";
const OSC133_ZONE_START = "\x1b]133;A\x07";
const OSC133_ZONE_END = "\x1b]133;B\x07";
const OSC133_ZONE_FINAL = "\x1b]133;C\x07";
const BG_RESET = "\x1b[49m";
describe("UserMessageComponent", () => {
test("keeps user message height stable while moving closing OSC markers off line end", () => {
initTheme("dark");
const component = new UserMessageComponent("hello");
const lines = component.render(20);
expect(lines).toHaveLength(3);
expect(lines[0]).toContain(OSC133_ZONE_START);
expect(lines[0].endsWith(BG_RESET)).toBe(true);
expect(lines[0]).not.toContain(OSC133_ZONE_END);
expect(lines[1]).toContain("hello");
expect(lines[2].startsWith(OSC133_ZONE_END + OSC133_ZONE_FINAL)).toBe(true);
expect(lines[2].endsWith(BG_RESET)).toBe(true);
});
});