fix(tui): prevented stale-buffer flicker

- Kept fullscreen replacement overlays mounted through asynchronous transcript rebuilds.
- Fused alternate-screen exit with destructive repaint and removed resize-time buffer switches.
- Preserved statically detected synchronized output when DECRQM probing is inconclusive.

Fixes #5319
This commit is contained in:
roboomp
2026-07-14 18:22:33 +00:00
parent 0a98aa252b
commit 68f84d7c20
14 changed files with 252 additions and 99 deletions
+2 -2
View File
@@ -141,9 +141,9 @@ Resize events are event-driven from `ProcessTerminal` to `TUI.requestRender()`.
Effects:
- A resize is an explicit user gesture: outside multiplexers the engine erases and replays (`ED3` + full paint) so history rewraps at the new geometry; the commit ledger restarts from the replayed frame.
- A resize is an explicit user gesture: outside multiplexers the engine rewrites only the visible viewport during the drag, directly on the normal buffer, then erases and replays once (`ED3` + full paint) after the drag settles so history rewraps at the new geometry. Avoiding alternate-screen switches prevents the saved pre-TUI normal buffer from flashing at settle on terminals without effective synchronized output.
- Inside terminal multiplexers, resize repaints the visible window in place after a settle debounce (issue #2088); pane history keeps its old wrap, like any shell output, because pane scrollback cannot be erased safely.
- Terminals that re-report their size when the alternate screen buffer is toggled (Warp reports a height one row different for the alt buffer) take the in-place path too. The non-multiplexer fast path borrows the alternate screen for drag frames, so on these terminals each alt enter/leave emits a fresh resize event, which re-enters the fast path — a self-sustaining loop that floods ED3 full repaints with stable geometry. `resizeRepaintsInPlace()` (covering multiplexers and these terminals; overridable via `PI_TUI_RESIZE_IN_PLACE`) routes them through the in-place repaint, which never touches the alt buffer.
- Terminals that re-report their size when the alternate screen buffer is toggled (Warp reports a height one row different for the alt buffer) take the same history-preserving in-place path. `resizeRepaintsInPlace()` covers multiplexers and these terminals and remains overridable via `PI_TUI_RESIZE_IN_PLACE`; the viewport-only direct-terminal path no longer toggles buffers, so the override controls settled history rewrap only.
- Overlay visibility can depend on terminal dimensions (`OverlayOptions.visible`); focus is corrected when overlays become non-visible after resize.
## Streaming and incremental UI updates