diff --git a/src/renderer/src/components/terminal-pane/pty-connection.ts b/src/renderer/src/components/terminal-pane/pty-connection.ts index cf2e7eb2401..f00be9964b0 100644 --- a/src/renderer/src/components/terminal-pane/pty-connection.ts +++ b/src/renderer/src/components/terminal-pane/pty-connection.ts @@ -2850,7 +2850,13 @@ export function connectPanePty( } function isHiddenStartupRendererQueryWindowActive(): boolean { - return shouldSnapshotHiddenCodexOutput && hiddenStartupRendererQueryPending.length > 0 + return ( + shouldSnapshotHiddenCodexOutput && + // Why: non-query bytes during the startup window can dirty hidden xterm + // state, so the parser must observe them before answering CPR/DECRQM. + (Date.now() < hiddenStartupRendererQueryWindowExpiresAt || + hiddenStartupRendererQueryPending.length > 0) + ) } function takeHiddenStartupRendererQueryPendingForForeground(data: string): {