fix(tui): avoid overlay scrollback inflation on widen

This commit is contained in:
Mario Zechner
2026-04-02 01:31:09 +02:00
parent 39b1bf7b62
commit af12464217
2 changed files with 5 additions and 3 deletions

View File

@@ -722,9 +722,10 @@ export class TUI extends Container {
minLinesNeeded = Math.max(minLinesNeeded, row + overlayLines.length);
}
// Ensure result covers the terminal working area to keep overlay positioning stable across resizes.
// maxLinesRendered can exceed current content length after a shrink; pad to keep viewportStart consistent.
const workingHeight = Math.max(this.maxLinesRendered, minLinesNeeded);
// Pad to at least terminal height so overlays have screen-relative positions.
// Excludes maxLinesRendered: the historical high-water mark caused self-reinforcing
// inflation that pushed content into scrollback on terminal widen.
const workingHeight = Math.max(result.length, termHeight, minLinesNeeded);
// Extend result with empty lines if content is too short for overlay placement or working area
while (result.length < workingHeight) {