szn

Bug 377 — OSC abort eats the byte after ESC

377. Apps that terminate titles without ST get literal-text corruption

File: src/input.zig:357-362 (advanceOscEsc); cf. correct pattern at src/input.zig:489-503 (dcs_sixel_esc) Severity: MEDIUM Status: ✅ FIXED

Fix (applied)

advanceOscEsc now aborts the OSC and reprocesses the pending ESC plus the offending byte through advanceEsc (a bare new ESC keeps the .esc state pending), so ESC]0;t ESC[31m runs the SGR instead of printing 31m literally. CAN/SUB-in-OSC fidelity remains tracked under #388.

Test: stray ESC in OSC aborts string and next sequence still runs — bug #377 (asserts exactly one cell written, with red foreground applied).

Problem

For ESC ] 0 ; title ESC [ 3 1 m: after the ESC, [ ≠ \ → toGround() and the [ is consumed as part of the abort. 31m then renders as literal text. xterm aborts the string and processes the new escape sequence normally. Minor fidelity gap also noted by the sweep: CAN/SUB inside OSC strings are absorbed as content instead of aborting per VT spec.

Fix (proposed)

Mirror dcs_sixel_esc: keep the offending byte and push it back through feed after leaving OSC; treat CAN (0x18)/SUB (0x1A) as aborts too. Test: unterminated title followed by SGR — expect colour change, no literal.