fix(coding-agent): replay queued appearance changes

This commit is contained in:
can1357
2026-07-31 19:01:33 +02:00
parent 540e8f5797
commit 78825403ad
2 changed files with 32 additions and 4 deletions
@@ -224,6 +224,31 @@ describe("InteractiveMode theme scrollback refresh", () => {
expect(writes.join("").split("\x1b[3J")).toHaveLength(3);
});
it("replays with the new palette when an automatic response wins the queued Ctrl+L race", async () => {
terminal.emitAppearanceReport("dark");
enableAutoTheme();
await terminal.waitForRender();
const fullRedraws = mode.ui.fullRedraws;
const writes: string[] = [];
const realWrite = terminal.write.bind(terminal);
vi.spyOn(terminal, "write").mockImplementation(data => {
writes.push(data);
realWrite(data);
});
terminal.appearanceOnRefresh = "light";
const epoch = getThemeEpoch();
terminal.sendInput("\x0c");
terminal.emitAppearanceReport("light");
await waitForThemeEpochToAdvance(epoch);
await terminal.waitForRender();
await Promise.resolve();
expect(getCurrentThemeName()).toBe("light");
expect(mode.ui.fullRedraws).toBe(fullRedraws + 2);
expect(writes.join("").split("\x1b[3J")).toHaveLength(3);
});
it("owns a synchronous refresh response before invoking the terminal", async () => {
terminal.emitAppearanceReport("dark");
enableAutoTheme();