From 662823c40cbbfa9a4a00a4f465533912cf0935ed Mon Sep 17 00:00:00 2001 From: can1357 Date: Fri, 12 Jun 2026 07:36:43 +0200 Subject: [PATCH] fix(tui): flushed queued image transmits before alt-screen frame paints - Drained `#imageBudget.takeTransmits()` and wrote the queued `a=t` sequences ahead of the paint in `TUI.#emitAltFrame`, matching the normal-screen path, so id-keyed placements and placeholder cells composed into the frame resolve against loaded data. - Fixed images first shown inside a fullscreen overlay (e.g. the settings shape preview) rendering as blank placeholder cells until the overlay closed. --- packages/tui/src/tui.ts | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/packages/tui/src/tui.ts b/packages/tui/src/tui.ts index cc7c0ddae..f16cd7473 100644 --- a/packages/tui/src/tui.ts +++ b/packages/tui/src/tui.ts @@ -2712,6 +2712,18 @@ export class TUI extends Container { #emitAltFrame(lines: string[], width: number, height: number): void { const fitted: string[] = new Array(height); for (let r = 0; r < height; r++) fitted[r] = lines[r] ?? ""; + // Flush queued image-data transmits (`a=t`, no visible output) before the + // paint so id-keyed placements and placeholder cells composed into this + // frame resolve against loaded data. The normal-screen path flushes these + // ahead of its paint; without this, an image first shown inside a + // fullscreen overlay (e.g. the settings shape preview) would render as + // blank placeholder cells until the overlay closed. + const imageTransmits = this.#imageBudget.takeTransmits(); + if (imageTransmits.length > 0) { + let transmitBuffer = ""; + for (const seq of imageTransmits) transmitBuffer += seq; + this.terminal.write(transmitBuffer); + } // Skip an identical repaint (the modal is mostly static between // keystrokes) — unless a forced repaint (resetDisplay, // requestRender(true)) is pending: the redraw gesture must repair a