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

@@ -6,6 +6,7 @@
- Fixed markdown H1 headings ending with inline code from leaking underline styling into trailing line padding
- Fixed slash-command argument autocomplete to await async `getArgumentCompletions()` results and ignore invalid return values, preventing crashes when extension commands provide asynchronous completions ([#2719](https://github.com/badlogic/pi-mono/issues/2719))
- Fixed non-capturing overlay padding from inflating scrollback and corrupting the viewport on terminal widen ([#2758](https://github.com/badlogic/pi-mono/pull/2758) by [@dotBeeps](https://github.com/dotBeeps))
## [0.64.0] - 2026-03-29

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) {