CSI ?6h is ignored, making the origin-mode code paths unreachableSeverity: MEDIUM
Status: ✅ FIXED
Files: src/input.zig:929-949, src/screen.zig:1076, src/screen.zig:1143
// src/input.zig:929-949 (abridged)
fn dispatchDecset(self: *InputParser, enable: bool) Error!void {
while (i < self.param_count) : (i += 1) {
switch (self.params[i]) {
1 => self.screen.mode.keypad = enable,
7 => self.screen.mode.line_wrap = enable,
12 => {}, // cursor blink — not implemented
25 => self.screen.mode.cursor = enable,
1000 => self.screen.mode.mouse_standard = enable,
...
else => {},
}
}
}
Mode 6 (DECOM) is absent. Screen.setOriginMode exists and is tested
(screen.zig:2278,2352,2362; input.zig:1889) but has no production caller, so
mode.origin can never become true in a running server.
Everything that branches on mode.origin is therefore dead — cursor addressing
(screen.zig:1076,1086,1134,1143), scroll behaviour (:1508) — and an
application that emits CSI ?6h silently gets absolute rather than
region-relative addressing. CSI ?6$p (DECRQM) also reports the mode as
unrecognised (input.zig:911-914).
This is an unimplemented wire-up rather than a wrong computation: the feature is fully implemented and tested, only the parser arm is missing.
6 => self.screen.setOriginMode(enable),
plus a 6 => entry in the non-private DECRQM status table so
CSI ?6$p reports the true state. Wiring this also activates the latent
overflow in bug #525, so fix that at the same time.
// src/input.zig — dispatchDecset
1 => self.screen.mode.keypad = enable,
6 => self.screen.setOriginMode(enable), // DECOM (bug #523)
7 => self.screen.mode.line_wrap = enable,
and a matching entry in the private DECRQM table so CSI ?6$p reports the true
state:
6 => if (self.screen.mode.origin) @as(u8, 1) else @as(u8, 2),
setOriginMode already existed and was tested; only the parser arm was missing,
which is why every origin-aware branch in screen.zig was dead.
DECSET/DECRST 6 toggles origin mode — bug #523 (src/input.zig) sets a scroll
region of rows 1..3, enables DECOM, and asserts mode.origin is set with the
cursor homed to the region’s top-left; it then disables DECOM and asserts the
cursor returns to row 0.
Verified with the full suite on Zig 0.16.0 and 0.17.0: 1052/1052 passing on both.
Bug #422 (DECSET 1003 aliased onto 1000; dead mouse_utf8 field) is a sibling
defect in the same dispatch table.