wire / terminal-dec-private-mode / 1006

DECSET 1006 — SGR mouse mode (extended mouse encoding)

CSI ? 1006 h selects the SGR mouse-report encoding: instead of the legacy +32 byte form, events are reported as CSI < Cb ; Cx ; Cy M (press) or CSI < Cb ; Cx ; Cy m (release), using decimal numbers. This removes the 223-column limit and the UTF-8 byte collisions of the legacy encoding. It is an ENCODING toggle, paired with a tracking mode like 1000/1002/1003.

terminal-dec-private-mode kind control-sequence status de-facto verification verified tier B terminal-escape@1

aka: SGR mouse mode · SGR mouse encoding · extended mouse mode · DECSET 1006 · ?1006h / ?1006l

frame

DEC-private-mode introducer: \x1b[? ESC [ ? (0x1B 0x5B 0x3F)

terminator (none): ST · BEL

parameters / subcommands

idnamebytes (ST)meaning
set Enable (DECSET) \x1b[?1006h CSI ? 1006 h selects SGR-encoded mouse reports. Combine with a tracking mode (1000/1002/1003) which decides WHICH events fire.
reset Disable (DECRST) \x1b[?1006l CSI ? 1006 l reverts to the legacy mouse encoding.
report-press Press report (terminal -> app) \x1b[<0;35;12M A button press is reported as CSI < Cb ; Cx ; Cy M, all decimal. Cb is the button+modifier code, Cx the 1-based column, Cy the 1-based row. Example: button 0 (left) press at col 35, row 12 = ESC [ < 0 ; 35 ; 12 M.
report-release Release report (terminal -> app) \x1b[<0;35;12m A button release is reported identically but with a lowercase 'm' final byte: CSI < Cb ; Cx ; Cy m. The final byte (M vs m) is what tells press from release — this is the key advantage over the legacy encoding, which could not distinguish which button was released.

gotchas


provenance

per-fact attribution:

see also

agent: curl -H 'accept: application/json' wire.phall.io/terminal-dec-private-mode/1006 or /terminal-dec-private-mode/1006.json