Skip to content

SGR mouse mode (DECSET 1006)

Category: modes · Baseline: modern · Tags: DEC Private Modes, Xterm Extensions · Specification ↗

ESC [ ? 1006 h
SGR mouse mode replaces the legacy X10 mouse encoding with a format that supports arbitrarily large coordinates. Enable with ESC [ ? 1006 h (in addition to a tracking mode like ?1000 or ?1003). Mouse events are reported as ESC [ < button ; col ; row M for press and ESC [ < button ; col ; row m for release. The SGR format solves critical limitations of legacy mouse reporting: coordinates are decimal (no 223-column limit), button press and release are distinguishable by the final character (M vs m), and the format is unambiguous (no byte-value collisions with control characters). All modern TUI frameworks use SGR mouse mode.
How this is testedautomated
Enable SGR mouse (CSI ? 1006 h), check getMode("sgrMouse") returns true. Confirms the backend tracks SGR mouse encoding mode.

The same probe runs against headless backends (via Termless) and real terminal apps (via a daemon launched in each terminal). This lets us distinguish parser correctness from rendering correctness.

Analysis2026-04-06

Supported by 11 of 12 terminals (92%). Not supported by: vt100.js. Part of the Modern TUI baseline. Notes: vt100.js: SGR mouse encoding not implemented — pure TypeScript emulator.

Supported by 9 of 14 backends (64%)

Terminal Applications

TerminalVersionSupportNotes
iTerm23.6.9✓ yesDECRPM: mode reset
Ghostty1.3.1✓ yesDECRPM: mode reset
VS Code✓ yes
Warp✓ yes
Cursor✓ yes
Terminal.app✓ yes

Headless Backends

Parser correctness only — a means the parser accepts the sequence.

BackendVersionSupportNotes
vterm0.2.0✓ yes
Alacritty0.26.0~ partialSGR mouse encoding not exposed via alacritty_terminal API
Kitty0.40.0~ partialSGR mouse encoding not exposed via Python batch bridge
WezTerm0.1.0-fork.5~ partialSGR mouse encoding not exposed via wezterm-term API
xterm.js5.5.0~ partialSGR mouse encoding not exposed in xterm.js headless mode
vt100.js0.2.1✗ noSGR mouse encoding not implemented — pure TypeScript emulator