Skip to main content

DECXCPR

AI-Generated Content
This page was generated with the assistance of AI and may contain inaccuracies. It is intended as a placeholder for future human verification. If you spot issues ahead of its initial review, please report them on GitHub!
Standard

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
Formal syntax
(* 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:

ParameterDescription
PrCurrent cursor row (1-based)
PcCurrent cursor column (1-based)
PpCurrent 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:

  1. The response includes a ? prefix: CSI ? Pr ; Pc ; Pp R
  2. 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​

SpecificationSection
VT510 Reference—

Terminal support​

TerminalSupportVersionNotes
Terminal Emulators
Alacritty✗NoOnly standard CPR (CSI 6n) supported, not extended
Bobcat✓0.9.0Supported via TerminalCtrl library
contour✓v0.3.0.198
foot✗NoOnly standard CPR is implemented, not extended DECXCPR
Ghostty✗NoExtended cursor position report (CSI ? 6n) not implemented; only standard CPR (CSI 6n) is supported
iTerm2✓YesExtended cursor position report implemented in reportActivePositionWithX:Y:withQuestion:vt330OrLater. Requires VT330+ emulation level (iTermEmulationLevel300).
Kitty✓YesDSR 6 with private parameter (?)
Konsole✗NoNo implementation found for extended cursor position report (CSI ? 6 n)
mintty✓YesImplemented at src/termout.c:3544-3547. Returns cursor position with ? prefix.
mlterm✓YesCSI ? 6n supported, returns page info
PuTTY✗NoExtended cursor position report (CSI ? 6n) not implemented
Rio✗No
rxvt-unicode✗NoOnly standard CPR (CSI 6n) supported, not extended DECXCPR (CSI ? 6n)
st✗NoCSI ? 6 n not handled; only standard CPR supported
terminology✓v1.10.0Extended cursor position report (CSI ? 6n) returns page number
VT100✗No
VTE✓YesExtended cursor position report, always reports page 1
WezTerm✗NoOnly standard CPR is implemented, not DECXCPR
Windows Terminal✓YesExtended CPR includes page number in response
xterm✓YesVT330+ feature, requires terminal ID >= 330
xterm.js✓2.3.0Reports as CSI ? y ; x R
Multiplexers
cy✗No
GNU Screen✗NoCSI ? 6n not implemented
tmux✗NoCSI ? 6n not handled; only standard DSR 6n (CPR) is supported
tuios✓v0.0.15
Zellij✗NoExtended cursor position report (CSI ? 6n) is not implemented; only standard CPR (CSI 6n) is supported

See also​