Please report XTVERSION in response to CSI > 0 q or set TERM to something other than xterm (or both) (original) (raw)
Description of the new feature
Ideally I think Windows Terminal would set the environment variable TERM to a unique value and also update the existing terminfo databases. However, I understand that the intermediate state that creates where many programs don't recognize the new terminal type is undesirable.
So in the meantime, can Windows Terminal report XTVERSION? From ctlseqs:
CSI > Ps q
Ps = 0 ⇒ Report xterm name and version (XTVERSION).
The response is a DSR sequence identifying the version:
DCS > | text ST
This escape sequence is pretty widely supported to send a unique string that identifies the name and version of a terminal. Off the top of my head, VTE-based terminals (such as GNOME Terminal), Konsole, iTerm2, WezTerm, Contour, and kitty all support this escape sequence.
Context: I am currently drafting up a patch to Emacs that will rely either TERM or XTVERSION to determine if xterm-mouse-mode is safe to be enabled by default. Emacs wants to see support fo OSC52 copy, bracketed paste, DECSET1000, and DECSET1003 at a minimum and checking XTVERSION or TERM is the only way I have to identify if these escape sequences are supported. Also see Emacs discussion thread.
Proposed technical implementation details
No response