szn

Bug 539 — status bar remains after exit

539. Exit-alt-screen sequence dropped on non-blocking stdout

Severity: MEDIUM Status: ✅ FIXED Files: src/main.zig

Problem

stdout was made non-blocking for backpressure handling. On exit, the deferred display.exitAltScreen() wrote \x1b[?1049l through writeBytes, which does not retry EAGAIN, so the sequence could be dropped and the terminal stayed on the szn screen. Pending out_buf bytes were also freed before the exit sequence ran.

Fix

Restore blocking mode on stdout, drain out_buf, and reorder the defers so exitAltScreen runs before out_buf is freed. Added setBlocking.

Verification

zig build / zig build test on 0.16.0; zig build on 0.17.0.