DECXCPR
DECXCPR (Extended Cursor Position Report) is a DEC private variant of CPR that includes the current page number in the response.
Syntax
CSI ? 6 n DECXCPR request
CSI ? Pr ; Pc ; Pp R DECXCPR response
(* Request *)
DECXCPR-request = 0x1b, "[", "?", "6", "n" ;
(* Response *)
DECXCPR-response = 0x1b, "[", "?", Pr, ";", Pc, ";", Pp, "R" ;
Pr = digit, { digit } ; (* row *)
Pc = digit, { digit } ; (* column *)
Pp = digit, { digit } ; (* page, usually 1 *)
digit = "0" | "1" | "2" | "3" | "4"
| "5" | "6" | "7" | "8" | "9" ;Response
The terminal responds with CSI ? Pr ; Pc ; Pp R where:
| Parameter | Description |
|---|---|
Pr | Current cursor row (1-based) |
Pc | Current cursor column (1-based) |
Pp | Current page number (typically 1) |
Description
Per the VT510 manual, DECXCPR is the DEC private version of the standard cursor position report. It is requested via CSI ? 6 n (a private-mode DSR) and differs from the standard CPR in two ways:
- The response includes a
?prefix:CSI ? Pr ; Pc ; Pp R - The response includes a third parameter for the page number
The page number parameter (Pp) is a legacy concept from multi-page DEC terminals. Modern terminals typically report page 1.
Since the response includes the ? prefix, applications can distinguish DECXCPR responses from standard CPR responses. This is useful when both queries may be in flight.
DECXCPR was introduced on the VT330 and later terminals. XTerm supports it when the terminal ID is set to 330 or higher.
Examples
# Request extended cursor position report
printf '\e[?6n'
# Response: ESC [ ? Pr ; Pc ; 1 R
Specifications
| Specification | Section |
|---|---|
| VT510 Reference | — |
Terminal support
| Terminal | Support | Version | Notes |
|---|---|---|---|
| Terminal Emulators | |||
| Alacritty | ✗ | No | Only standard CPR (CSI 6n) supported, not extended |
| Bobcat | ✓ | 0.9.0 | Supported via TerminalCtrl library |
| contour | ✓ | v0.3.0.198 | |
| foot | ✗ | No | Only standard CPR is implemented, not extended DECXCPR |
| Ghostty | ✗ | No | Extended cursor position report (CSI ? 6n) not implemented; only standard CPR (CSI 6n) is supported |
| iTerm2 | ✓ | Yes | Extended cursor position report implemented in reportActivePositionWithX:Y:withQuestion:vt330OrLater. Requires VT330+ emulation level (iTermEmulationLevel300). |
| Kitty | ✓ | Yes | DSR 6 with private parameter (?) |
| Konsole | ✗ | No | No implementation found for extended cursor position report (CSI ? 6 n) |
| mintty | ✓ | Yes | Implemented at src/termout.c:3544-3547. Returns cursor position with ? prefix. |
| mlterm | ✓ | Yes | CSI ? 6n supported, returns page info |
| PuTTY | ✗ | No | Extended cursor position report (CSI ? 6n) not implemented |
| Rio | ✗ | No | |
| rxvt-unicode | ✗ | No | Only standard CPR (CSI 6n) supported, not extended DECXCPR (CSI ? 6n) |
| st | ✗ | No | CSI ? 6 n not handled; only standard CPR supported |
| terminology | ✓ | v1.10.0 | Extended cursor position report (CSI ? 6n) returns page number |
| VT100 | ✗ | No | |
| VTE | ✓ | Yes | Extended cursor position report, always reports page 1 |
| WezTerm | ✗ | No | Only standard CPR is implemented, not DECXCPR |
| Windows Terminal | ✓ | Yes | Extended CPR includes page number in response |
| xterm | ✓ | Yes | VT330+ feature, requires terminal ID >= 330 |
| xterm.js | ✓ | 2.3.0 | Reports as CSI ? y ; x R |
| Multiplexers | |||
| cy | ✗ | No | |
| GNU Screen | ✗ | No | CSI ? 6n not implemented |
| tmux | ✗ | No | CSI ? 6n not handled; only standard DSR 6n (CPR) is supported |
| tuios | ✓ | v0.0.15 | |
| Zellij | ✗ | No | Extended cursor position report (CSI ? 6n) is not implemented; only standard CPR (CSI 6n) is supported |
See also
- DSR/CPR — Device Status Report — Standard cursor position report
- CUP — Cursor Position — Set cursor position