Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/cli/tui/panels/embedded-terminal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -915,7 +915,7 @@ const buildCompactRenderableLines = (
}

let statusIndex = -1;
for (let lookahead = 2; lookahead < Math.min(rows.length - index, 8); lookahead += 1) {
for (let lookahead = 2; lookahead < Math.min(rows.length - index, 50); lookahead += 1) {
const candidate = rows[index + lookahead];
if (candidate !== undefined && isCommandStatusLine(candidate.plainText)) {
commandBlock.push(candidate);
Expand Down Expand Up @@ -1263,7 +1263,7 @@ export class EmbeddedTerminalPane {
}

let statusLine: string | null = null;
for (let lookahead = index + 2; lookahead < Math.min(rows.length, index + 10); lookahead += 1) {
for (let lookahead = index + 2; lookahead < Math.min(rows.length, index + 50); lookahead += 1) {
const candidate = rows[lookahead]?.plainText ?? "";
if (isCommandStatusLine(candidate)) {
statusLine = candidate;
Expand Down Expand Up @@ -1375,7 +1375,7 @@ export class EmbeddedTerminalPane {
}

let hasStatusLine = false;
for (let lookahead = index + 2; lookahead < Math.min(rows.length, index + 8); lookahead += 1) {
for (let lookahead = index + 2; lookahead < Math.min(rows.length, index + 50); lookahead += 1) {
if (isCommandStatusLine(rows[lookahead]?.plainText ?? "")) {
hasStatusLine = true;
break;
Expand Down
11 changes: 11 additions & 0 deletions src/cli/tui/terminal-emulator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -710,6 +710,17 @@ export class TerminalEmulatorBuffer {
}

if (sequence === "\u001b[?1049l") {
// Flush non-blank alternate screen rows to scrollback so codex's TUI
// output survives the screen switch (otherwise the content is discarded).
const altRows = this.alternateScreenBuffer;
let lastNonBlank = altRows.length - 1;
while (lastNonBlank >= 0 && altRows[lastNonBlank]!.every((cell) => cell.char.length === 0)) {
lastNonBlank -= 1;
}
for (let i = 0; i <= lastNonBlank; i += 1) {
this.pushScrollback(altRows[i]!);
}

this.alternateScreen = false;
if (this.savedMainState) {
this.mainScreen = this.savedMainState.screen.map((row) => cloneRow(row, this.columns));
Expand Down
Loading