fix(tui): keep queued-message rows out of scrollback

Op: correct

Restores: spec: queued-message live rows must not be committed to native scrollback
This commit is contained in:
metaphorics
2026-07-03 05:55:31 +09:00
committed by can1357
parent 734aed4c03
commit a82bbd89d7
2 changed files with 12 additions and 2 deletions
@@ -644,7 +644,7 @@ export class InteractiveMode implements InteractiveModeContext {
// unless the user opts in, and never emits raw escapes on other terminals.
setTerminalTextSizing(settings.get("tui.textSizing") && TERMINAL.textSizing);
this.chatContainer = new TranscriptContainer();
this.pendingMessagesContainer = new Container();
this.pendingMessagesContainer = new AnchoredLiveContainer();
this.statusContainer = new AnchoredLiveContainer();
this.todoContainer = new AnchoredLiveContainer();
this.subagentContainer = new AnchoredLiveContainer();
@@ -18,7 +18,7 @@ import { AuthStorage } from "@oh-my-pi/pi-coding-agent/session/auth-storage";
import { SILENT_ABORT_MARKER, USER_INTERRUPT_LABEL } from "@oh-my-pi/pi-coding-agent/session/messages";
import { SessionManager } from "@oh-my-pi/pi-coding-agent/session/session-manager";
import { AUTO_THINKING } from "@oh-my-pi/pi-coding-agent/thinking";
import { setKeybindings } from "@oh-my-pi/pi-tui";
import { setKeybindings, Text } from "@oh-my-pi/pi-tui";
import { formatNumber, TempDir } from "@oh-my-pi/pi-utils";
/**
@@ -131,6 +131,16 @@ describe("InteractiveMode plan review rendering", () => {
resetSettingsForTest();
});
it("keeps queued-message rows in the live region instead of native scrollback", () => {
const liveRegion = mode.pendingMessagesContainer as {
getNativeScrollbackLiveRegionStart?: () => number | undefined;
};
expect(liveRegion.getNativeScrollbackLiveRegionStart?.()).toBeUndefined();
mode.pendingMessagesContainer.addChild(new Text("Queued: follow-up"));
expect(liveRegion.getNativeScrollbackLiveRegionStart?.()).toBe(0);
});
it("exits empty plan mode without confirmation", async () => {
const planFilePath = "local://PLAN.md";
const resolvedPlanPath = resolveLocalUrlToPath(planFilePath, {