XTVERSION Report Version
Ask the terminal for its name and version.
CSI > Ps q
- Defaults
- Ps = 0
- xterm
- Functions using CSI
CSI > q, or CSI > 0 q, asks the terminal for its name and version. The answer is a device control string, DCS > | text ST. Where DA answers with what a terminal claims to be compatible with, which is usually a VT terminal, this answers with what it actually is, so a program can work around a particular terminal’s bugs.
It is xterm’s. xterm answers only when the parameter is 0 or left out, and its text is XTerm( and its patch number ) (CASE_REPORT_VERSION, xtermVersion). The snapshot this site links to, tagged xterm-411a, is a step toward patch 412 and calls itself that (version.h).
The text is the terminal’s own, so no other terminal gives xterm’s, and that case is a known difference by nature. libghostty-vt asks its host through the XTVERSION callback, and without one, as here, answers libghostty; Ghostty answers ghostty and its version. It also answers when the parameter is not 0, which xterm does not, a second known difference.
Validation
XTVERSION-1: Name and version
\e[>q
|______|
reply \eP>|XTerm(412)\e\\
XTVERSION-2: Only for 0
\e[>1q
|______|
reply none
XTVERSION-3: Nothing on screen
A
\e[>q
B
|AB____|
cursor 1,3