File: src/screen.zig (resize path)
Severity: MEDIUM
Status: ✅ FIXED
Screen.resize now clamps the DECSTBM scroll region into the new height
(dropping it when degenerate, top >= bottom) and clamps both saved cursors
(DECSC main + alternate) exactly like the live cursor.
Test: resize clamps scroll region and saved cursor — bug #372.
Resizing clamps the live cursor but leaves:
top/bottom margins) pointing past the new height;A later LF with origin mode, RI, or restore-cursor then indexes out of bounds
or scrolls wrongly until the application reissues DECSTBM/DECSC. Fix as one
invariant cleanup in resize(): clamp region to [0, height) with empty-region
reset when degenerate, clamp saved cursor like the live one.
Reported together by the audit sweep as H4/H5 of the terminal-emulation review.