fix(tui): corrected TUI scrollback preservation during rerenders

- Preserved preexisting terminal scrollback during forced and structural rerenders in TUI.#prepareForcedRender.
- Gated historyRebuild triggers on #scrollbackHighWater in TUI.#canReplayNativeScrollbackAtCheckpoint.
- Expanded render-stress coverage with child mutations, viewport variants, and replay-mode scenario parsing.
This commit is contained in:
can1357
2026-05-31 08:44:43 +02:00
parent 9fabd5e4d5
commit 730e598786
3 changed files with 589 additions and 85 deletions
+1 -1
View File
@@ -1,7 +1,6 @@
# Changelog
## [Unreleased]
### Added
- Added `overflowSearch` to `SelectListLayoutOptions` to let consumers enable or disable type-to-filter search and search-status rendering per SelectList instance
@@ -13,6 +12,7 @@
### Fixed
- Preserved existing terminal scrollback during forced and structural TUI renders so preexisting shell lines remained visible after component mutations
- Rebuilt native scrollback for safe bottom-anchored offscreen edits and high-water preview collapses instead of repainting only the viewport, preventing stale or duplicated rows above the live viewport.
- Stripped internal cursor marker sentinels from all rendered lines so offscreen focus markers no longer leak into terminal output
- Truncated all painted lines to terminal width during viewport repaints and append-tail updates so long content no longer overflows or wraps unexpectedly
+3 -1
View File
@@ -705,8 +705,9 @@ export class TUI extends Container {
#prepareForcedRender(clearScrollback: boolean): void {
this.#clearScrollbackOnNextRender ||= clearScrollback;
const droppedLines = this.#previousLines.length > 0;
this.#previousLines = [];
this.#previousLinesDroppedForForcedRender = true;
this.#previousLinesDroppedForForcedRender = droppedLines;
this.#previousWidth = -1; // -1 triggers widthChanged, forcing a full clear
this.#previousHeight = -1; // -1 triggers heightChanged, forcing a full clear
this.#cursorRow = 0;
@@ -1382,6 +1383,7 @@ export class TUI extends Container {
}
if (
newLines.length !== this.#previousLines.length &&
this.#scrollbackHighWater > 0 &&
this.#canReplayNativeScrollbackAtCheckpoint(nativeViewportAtBottom, allowUnknownViewportMutation)
) {
return { kind: "historyRebuild" };
File diff suppressed because it is too large Load Diff