Expand description
Device Status Reports and cursor-position reports.
§Category
This module emits DSR requests and report responses: cursor position, extended cursor position, light/dark preference, and terminal visibility reporting. It also carries DECRQSS and its DECRPSS response, which ask after a current setting rather than device status.
§CSI conventions
ANSI DSR uses ESC [ Ps n; DEC-private DSR inserts ?. Cursor reports use
final byte R, while light/dark and visibility reports use private DSR
numbers.
§Mode interaction
The light/dark notification request is related to
Mode::LIGHT_DARK, DEC private mode
2031, and the visibility request to
Mode::VISIBILITY_REPORTS,
DEC private mode 2033. Both queries report once without changing their
mode. Cursor-position reports are independent of modes but may be
interpreted relative to terminal origin behavior.
Constants§
- REQUEST_
CURSOR_ POSITION - Request standard cursor position: exact bytes
ESC [ 6 n(b"\x1b[6n"). - REQUEST_
EXTENDED_ CURSOR_ POSITION - Request extended cursor position: exact bytes
ESC [ ? 6 n(b"\x1b[?6n"). - REQUEST_
LIGHT_ DARK_ REPORT - Request light/dark preference report: exact bytes
ESC [ ? 996 n(b"\x1b[?996n"). - REQUEST_
VISIBILITY_ REPORT - Request a terminal visibility report: exact bytes
ESC [ ? 998 n(b"\x1b[?998n").
Functions§
- write_
cpr - Encode a standard Cursor Position Report response,
ESC [ <line> ; <column> R. - write_
decrpss - Encode a DECRPSS report,
ESC P <ps> $ r <D...D> ESC \. - write_
decrqss - Request a current setting with DECRQSS,
ESC P $ q <selector> ESC \. - write_
decxcpr - Encode an extended Cursor Position Report response.
- write_
dsr_ request - Encode a Device Status Report request.
- write_
light_ dark_ report - Encode a light/dark report response.
- write_
request_ cursor_ position - Write
REQUEST_CURSOR_POSITION, the standard DSR 6 cursor-position request. - write_
request_ extended_ cursor_ position - Write
REQUEST_EXTENDED_CURSOR_POSITION, the DEC private extended cursor-position request. - write_
request_ light_ dark_ report - Write
REQUEST_LIGHT_DARK_REPORT, the light/dark preference query. - write_
request_ visibility_ report - Write
REQUEST_VISIBILITY_REPORT, the one-shot terminal visibility query. - write_
visibility_ report - Encode a terminal visibility report response.