You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Area-VTVirtual Terminal sequence supportIssue-FeatureComplex enough to require an in depth planning process and actual budgeted, scheduled work.Product-TerminalThe new Windows Terminal.
neovim uses XTGETTCAP sequence to query osc52 support and enables copying over ssh via osc52 if positive. wt supports osc52 but does not report via XTGETTCAP, so neovim is not aware of it and won't enable osc52 for wt.
Why does this depend on [#2958] shouldnt support XTGETTCAP return dynamically what is supported?? Depending on registering a terminfo would also cause all systems connecting to via ssh to have it also.
Doesn't really depend on us "registering" one, but we do need a way to author it and have it kept up to date.
Honestly, it also sounds like doing this would be the right solution to #1040. Probably not good enough for all use cases, but it's strictly better than terminfos
<conjecture>
Historically, probably added around 2019?
Note that XTGETTCAP doesn't actually report the terminfo and termcap capabilities that you might expect it to. It's mostly for reporting key sequences. Quoting the Xterm documention:
The string following the "q" is a list of names ... which correspond to termcap or terminfo capability names for special keyboard keys. other capabilities ... are intentionally not part of this interface.
Then it goes on to say:
A few more terminal capabilities are recognized, which are not names of special keys:
Co for termcap colors
TN for termcap name
RGB for the ncurses direct-color extension
It's basically those three properties and a bunch of key sequences. It's not particularly useful for detecting a terminal's capabilities.
As for the original justification in the issue description, neovim now detects clipboard support via a DA1 extension (see neovim/neovim#34860), so it's definitely not needed for that.
Note that `XTGETTCAP` doesn't actually report the terminfo and termcap capabilities that you might expect it to.
Only xterm's variant.
XTGETTCAP was later extended by kitty and then foot to expose bool, integer and string capabilities.
At least foot exposes its entire terminfo via XTGETTCAP.
The protocol is also implemented by at least wezterm, contour and ghostty.
As for the original justification in the issue description,
neovim now detects clipboard support via a `DA1` extension (see
neovim/neovim#34860), so it's definitely
not needed for that.
I do think it's enticing for XTGETTCAP to expose all keys. The locally installed terminfo may be a version-mismatch to the terminal that is connecting via e.g. SSH. With this we could expose all sorts of things in a somewhat safe manner, including something that has been absent on Windows for too long: TERM (we are separately looking into fixing that fwiw; no promises).
Leonard Hecker (@lhecker) Just bear in mind that if you want to expose all keys, you can't remain compatible with xterm. As Johannes Altmanninger (@krobelus) noted, a number of terminals have done that, but it's not so much an extension as a hijack of xterm's protocol with their own incompatible variant (and they aren't always compatible with each other).
And on the subject of TERM, if you're planning on changing the default from xterm-256color, be aware that you're setting yourself up for a life time of bug reports. If you want an idea of what that will look like, just browse the issue trackers of terminals like alacritty (#2838, #3932, #3962, #8677) and ghostty (#896, #3348, #12319, #14342). I've just linked a few examples, but this comes up a lot.
And they're at least in a position where they can install their terminfo as part of the terminal's installation, and provide shell scripts for installing over ssh, but that hasn't really helped them.
As Johannes Altmanninger (@krobelus) noted, a number of terminals have done that, but it's not so much an extension as a hijack of xterm's protocol with their own incompatible variant (and they aren't always compatible with each other).
I considered it enticing, because we'll otherwise always have the issue of "how do we ship an up-to-date terminfo". I do think having a protocol like that is a nice idea, since it finally ensures terminal and terminfo are in sync. How bad is it to extend the xterm protocol like that?
And on the subject of TERM, if you're planning on changing the default from xterm-256color, be aware that you're setting yourself up for a life time of bug reports.
Are you referring to TERM via XTGETTCAP or to my (comment in parenthesis)? For the latter, I was indeed thinking of changing it to ms-terminal, for long-term profit. But that's not something I intend to pursue eagerly. Instead, what I meant was that Dustin was looking into setting env vars in already launched console processes (during handoff). This requires driver changes and so there's some hesitation.
If you meant TERM via XTGETTCAP, I was assuming the issues would not apply as a client would have to fetch it with XTGETTCAP and then look up keys in its terminfo with the returned value. That seems rather odd to me.
(I do realize that if we introduce this, applications will immediately use it to write ""workarounds"" for Windows Terminal's behavior, which would be rather sad too.)
it finally ensures terminal and terminfo are in sync
But how? Nobody is going to use XTGETTCAP to download a full terminfo database. Or so I would hope, because that would be insane. Before you even start you've got to assume: 1. The terminal is ANSI compliant; 2. It supports the DCS control without leaking the content; 3. It supports the XTGETTCAP sequence, and not even the standard form of it, but some undefined extension that will respond in the way that you're hoping. And after assuming all of that, you're still unsure whether you can use an ANSI standard CUP to position the cursor, so you need to look that up in terminfo!?
All of the places I've seen XTGETTCAP being used have been for a handful of caps at most - and typically non-standard caps like Ms or Smulx. And they often aren't even looking at the response - just treating it like a boolean indication of support, and assuming the sequence format. In most cases there is a standard query you could use to get the same information more reliably, which is what I would advise.
That said, if you think there is value in trying to support those use cases, feel free. But don't kid yourself that this is some kind of runtime terminfo. It's a giant hack built on top of a sequence that was never intended to do the thing that these people are using it for.
How bad is it to extend the xterm protocol like that?
Well the risk is that anyone trying to use XTGETTCAP for its original purpose will break when querying a terminal that doesn't respond in the standard way. This will depend on how you decide to handle things like escaping, multipart queries, unrecognised keys, etc. It might be possible to implement it in a way that is still backwards compatible, but I don't think it will be simple.
Are you referring to TERM via XTGETTCAP or to my (comment in parenthesis)?
I was assuming you were planning to change the environment variable, but the XTGETTCAP value would likely have the same effect if apps are using it in the same way (i.e. like a browser user-agent). Incidentally, this is why terminals like ghostty and kitty include xterm in their TERM name. Without that, a lot of apps just won't work properly.
And yes, once you have a unique TERM name, apps are guaranteed to start using it in the same way as they are now using WT_SESSION. If that's something we want to endorse, we should just go ahead and implement XTVERSION and set the TERM_PROGRAM environment variable instead. That will at least cause less breakage than changing the TERM name.
Area-VTVirtual Terminal sequence supportIssue-FeatureComplex enough to require an in depth planning process and actual budgeted, scheduled work.Product-TerminalThe new Windows Terminal.
Activity
carlos-zamora commentedon Aug 21, 2024
Depends on #2958 and #1040
cavanaug commentedon Feb 18, 2025
Why does this depend on [#2958] shouldnt support XTGETTCAP return dynamically what is supported?? Depending on registering a terminfo would also cause all systems connecting to via ssh to have it also.
DHowett commentedon Feb 18, 2025
I rather think it means "depends on the part of that issue which requires producing a terminfo" :)
zadjii-msft commentedon Nov 23, 2026
Docs:
https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h4-Device-Control-functions:DCS-plus-q-Pt-ST.F95
Doesn't really depend on us "registering" one, but we do need a way to author it and have it kept up to date.
Honestly, it also sounds like doing this would be the right solution to #1040. Probably not good enough for all use cases, but it's strictly better than terminfos
<conjecture>
Historically, probably added around 2019?
j4james commentedon Nov 24, 2026
Note that
XTGETTCAPdoesn't actually report the terminfo and termcap capabilities that you might expect it to. It's mostly for reporting key sequences. Quoting the Xterm documention:Then it goes on to say:
It's basically those three properties and a bunch of key sequences. It's not particularly useful for detecting a terminal's capabilities.
As for the original justification in the issue description, neovim now detects clipboard support via a
DA1extension (see neovim/neovim#34860), so it's definitely not needed for that.krobelus commentedon Nov 24, 2026
lhecker commentedon Nov 24, 2026
I do think it's enticing for XTGETTCAP to expose all keys. The locally installed terminfo may be a version-mismatch to the terminal that is connecting via e.g. SSH. With this we could expose all sorts of things in a somewhat safe manner, including something that has been absent on Windows for too long:
TERM(we are separately looking into fixing that fwiw; no promises).j4james commentedon Nov 24, 2026
Leonard Hecker (@lhecker) Just bear in mind that if you want to expose all keys, you can't remain compatible with xterm. As Johannes Altmanninger (@krobelus) noted, a number of terminals have done that, but it's not so much an extension as a hijack of xterm's protocol with their own incompatible variant (and they aren't always compatible with each other).
And on the subject of
TERM, if you're planning on changing the default from xterm-256color, be aware that you're setting yourself up for a life time of bug reports. If you want an idea of what that will look like, just browse the issue trackers of terminals like alacritty (#2838, #3932, #3962, #8677) and ghostty (#896, #3348, #12319, #14342). I've just linked a few examples, but this comes up a lot.And they're at least in a position where they can install their terminfo as part of the terminal's installation, and provide shell scripts for installing over ssh, but that hasn't really helped them.
lhecker commentedon Nov 24, 2026
I considered it enticing, because we'll otherwise always have the issue of "how do we ship an up-to-date terminfo". I do think having a protocol like that is a nice idea, since it finally ensures terminal and terminfo are in sync. How bad is it to extend the xterm protocol like that?
Are you referring to TERM via XTGETTCAP or to my (comment in parenthesis)? For the latter, I was indeed thinking of changing it to
ms-terminal, for long-term profit. But that's not something I intend to pursue eagerly. Instead, what I meant was that Dustin was looking into setting env vars in already launched console processes (during handoff). This requires driver changes and so there's some hesitation.If you meant TERM via XTGETTCAP, I was assuming the issues would not apply as a client would have to fetch it with XTGETTCAP and then look up keys in its terminfo with the returned value. That seems rather odd to me.
(I do realize that if we introduce this, applications will immediately use it to write ""workarounds"" for Windows Terminal's behavior, which would be rather sad too.)
j4james commentedon Nov 24, 2026
But how? Nobody is going to use
XTGETTCAPto download a full terminfo database. Or so I would hope, because that would be insane. Before you even start you've got to assume: 1. The terminal is ANSI compliant; 2. It supports theDCScontrol without leaking the content; 3. It supports theXTGETTCAPsequence, and not even the standard form of it, but some undefined extension that will respond in the way that you're hoping. And after assuming all of that, you're still unsure whether you can use an ANSI standardCUPto position the cursor, so you need to look that up in terminfo!?All of the places I've seen
XTGETTCAPbeing used have been for a handful of caps at most - and typically non-standard caps likeMsorSmulx. And they often aren't even looking at the response - just treating it like a boolean indication of support, and assuming the sequence format. In most cases there is a standard query you could use to get the same information more reliably, which is what I would advise.That said, if you think there is value in trying to support those use cases, feel free. But don't kid yourself that this is some kind of runtime terminfo. It's a giant hack built on top of a sequence that was never intended to do the thing that these people are using it for.
Well the risk is that anyone trying to use
XTGETTCAPfor its original purpose will break when querying a terminal that doesn't respond in the standard way. This will depend on how you decide to handle things like escaping, multipart queries, unrecognised keys, etc. It might be possible to implement it in a way that is still backwards compatible, but I don't think it will be simple.I was assuming you were planning to change the environment variable, but the
XTGETTCAPvalue would likely have the same effect if apps are using it in the same way (i.e. like a browser user-agent). Incidentally, this is why terminals like ghostty and kitty includextermin theirTERMname. Without that, a lot of apps just won't work properly.And yes, once you have a unique
TERMname, apps are guaranteed to start using it in the same way as they are now usingWT_SESSION. If that's something we want to endorse, we should just go ahead and implementXTVERSIONand set theTERM_PROGRAMenvironment variable instead. That will at least cause less breakage than changing theTERMname.