szn

Bug 131 — input.zig — SOS/PM/APC string doesn’t handle ESC \ (ST) terminator correctly

131. input.zig — SOS/PM/APC string doesn’t handle ESC \ (ST) terminator correctly

File: src/input.zig:461–471 Severity: MEDIUM Status: ✅ FIXED — added sos_pm_apc_esc sub-state. ESC inside SOS/PM/APC now waits for \ to terminate, matching OSC behavior. Test added. (related to bug #18 which fixed OSC ST terminator, but SOS/PM/APC still broken)

fn advanceSosPmApc(self: *InputParser, byte: u8) void {
    switch (byte) {
        0x1B => {
            self.state = .esc;
        },
        0x9C => { self.toGround(); },
        else => {},
    }
}

When ESC is seen inside a SOS/PM/APC string, the parser transitions to .esc instead of staying in-string to check for \ (completing the ST terminator). If the next byte is \, the .esc handler treats it as an unrecognized ESC sequence rather than terminating the string.