xonecas.io
64875
Mc

mini-coder / commit da25fe3

fix(tui): keep the live region's anchor across a resize

handleResize dropped the region's anchor, so the next frame was written at the
cursor without erasing the region it replaced: every resize left a copy of the
status row (and a blank row) behind, and nine consecutive shrinks stacked nine
of them.

A reflow moves the region but leaves the cursor on the line it was on, so the
region's top is still `cursorUp` rows above it. Erase it there and redraw in
place. LiveRegion.reset() had no other caller and goes with it.

ux-walk-20260924 finding 3.

xonecas2026-09-25 da25fe30ea4d7c275bda75d8c3ca466d7aa0d7ed parent 89e140b

1 file changed

src/tui/tui.ts+3−9
@@ -98,11 +98,6 @@ class LiveRegion {
9898 return this.rows;
9999 }
100100
101- reset(): void {
102- this.rows = 0;
103- this.cursorUp = 0;
104- }
105-
106101 clear(): string {
107102 if (this.rows === 0) return "";
108103 let out = "";
@@ -206,10 +201,9 @@ class Tui {
206201 };
207202
208203 private handleResize(): void {
209- // Reflow invalidates cursor-relative coordinates. Drop the anchor instead
210- // of guessing and never erase committed history.
211- this.live.reset();
212- this.reanchor = true;
204+ // A reflow moves the region but leaves the cursor on the line it was on, so
205+ // the region's top is still `cursorUp` rows above it. Redraw over the old
206+ // region instead of dropping the anchor, which would leave it behind.
213207 this.render();
214208 }