-
Notifications
You must be signed in to change notification settings - Fork 65
Add support for XTGETTCAP #98
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Not a fan of this at all. Why do you want this? |
mostly because it started to get used in toolkits. I'd at least like to look into what it is a bit. |
Which one? |
@chrisduerr I think I mentioned? it's notcurses, some recent go toolkits, etc. It's also present in basically any active terminal. |
From my experience, the currently released Neovim 0.10 uses XTGETTCAP as the escape sequence to detect OSC 52 support automatically and thus clipboard function within itself. This is very useful for me when I want to copy code from one remote machine and quickly paste it into another to check something. |
Why wouldn't we want all terminal emulators to support this mechanism? TERM has serious long-term problems. |
Because this also has serious problems, which is why it hasn't really been used by anything for like a century. But people got fed up with trying to make something new work so instead they're trying to switch from one set of problems to another. At the end of the day this just creates fragmentation with no benefits. |
What are the serious problems? |
99% of the features identified in a modern terminfo file are just standard ANSI or DEC sequences, or commonly supported Xterm extensions, that every modern terminal implements. This is why so many terminals can get away with just setting their TERM to xterm-256colors. Inventing a proprietary escape sequence for apps to look up a bunch of ANSI-standard escape sequences is patently ridiculous. And if you're going to say that you're not using If there is a feature that isn't universally supported (like say |
Btw, notcurses is another example of unnecessary Expecting terminals to implement all of the cruft associated with |
OSC 52 is a part of terminfo though already and was that for a while, I have no idea why neovim decided to not use terminfo as a fallback for it, sounds like just a push for The only real place where it kind of matters, is when you ssh into remote without your terminfo installed or with some dated version of it. I'd state again that |
But it's such a convoluted definition considering what little information it provides. For Xterm it's defined as And in the case of nvim, they basically treat it like a boolean capability - if the definition starts with
And that's the root of the problem, because terminfo was a great idea maybe 40 years ago, when you were trying to write an app that could work on many different hardware terminals with wildly different escape sequences. In this day and age, assuming you're writing a modern application targeting modern software terminals, terminfo causes more problems than it solves. That said, if you (Alacritty) actually want to support |
There's also issues beyond what you mentioned, like the question of which terminfo to report and the fact that you need to query non-standard stuff like Smulx separately since processing is interrupted as soon as any invalid name is found in the requested list. |
I personally don't mind if certain apps really force the rest by starting doing so, but I just don't like it myself either. |
can you force neovim to enable it? Sounds like there should be a way to do so. |
The mechanism still seems pretty useful to me. With XTGETTCAP, programs request only the capabilities they need, so why would it hurt anything that information on , say, ANSI capabilities would be harmful, even if most terminals will report the same strings for those capabilities? IMHO, there's a lot of value in having a single converged capability detection mechanism that works for both old, boring capabilities and new, exciting ones. Maybe it'd be simpler to support only Boolean flags instead of parameterized capabilities, but IMHO not simpler enough that it's worth making an alternative feature detection system. I plan to add support for XTGETTCAP to Emacs term, FWIW. I want to solve the ssh problem once and for all. |
Do you understand that terminfo will have new exciting ones as well, since they have the same source and one is based on another? Unless you're talking about a new protocol, nothing will change, except ssh miss-matches, as said. |
Solved with one scp | tic command or running systems that are not 5-7 years old. |
Well this escape isn't that, so I don't see the point. |
Yes, you can: vim.g.clipboard = {
name = 'OSC 52',
copy = {
['+'] = require('vim.ui.clipboard.osc52').copy('+'),
['*'] = require('vim.ui.clipboard.osc52').copy('*'),
},
paste = {
['+'] = require('vim.ui.clipboard.osc52').paste('+'),
['*'] = require('vim.ui.clipboard.osc52').paste('*'),
},
} (see |
Oh yeah, I forgot about that mess. And it's actually worse than you think. In practice you can never reliably query more than one capability at a time, regardless of whether they're standard or not, because every terminal handles multi-value queries differently. |
Some systems don't have their terminfo databases updated for years. Many don't know about kitty at all, for example.
I'm not sure why it's better to mutate state on other systems (on some of which, the system-global terminfo directories are immutable, meaning you need to use environment variable hacks to point at some custom directory you create) than to just have the terminal report its own capabilities. UA sniffing has been deprecated on the web for years. Why is it a good thing in terminals?
People often either connect to older systems or run old base images themselves. There are people still using Ubuntu 20.04 as a base. Backporting a new libterminfo just for one or two newer programs somebody might want to run doesn't make sense.
It could be, if this bug were fixed:
An introspection mechanism solves multiple problems. There are no downsides AFAICT. The proposed workarounds are inconvenient, stateful, or incompatible with older systems. When everyone, or nearly everyone, supports introspection, users will benefit. |
And they would never support
no one will backport
terminfo can be installed for a user, you don't need root, you mutate only your user and that's about it. User is the one responsible for copying it in any sane terminal.
in a far future, once they update their systems to new programs running software supporting |
That is no bug, it's intended to behave this way.
There are no downsides, if we ignore the numerous downsides that have been laid out? Very convenient. You can't just hijack an old escape sequence and demand that it should suddenly behave differently because that would be convenient for you. |
I'm confused. I've yet to see a mention of a downside to an introspection. I've seen vigorous insistence that existing workarounds are sufficient, but I haven't seen any downsides of introspection itself.
Once programs generally support terminal introspection, the update problem will be solved for good from that moment onward even if the mechanism wouldn't help users of today's older systems. The world continues to evolve. It's hard to grasp the opposition here to solving real user problems. I will be unable to recommend that people use or developers support terminals that are not interested in solving user problems. |
Besides: what happens when an existing terminal emulator gains new capabilities and a program wanting to use those capabilities wants to know whether to enable them? With the static TERM approach, there's no way to describe version specific capabilities except by defining a new TERM name, and new TERM names cause users real inconvenience. Introspection solves the problem: it lets applications ask the specific terminal emulator binary they're using its capabilities instead of trying to infer them from the name of the program. |
You're creating problems by further fragmenting the ecosystem, not solving anything. |
How would you solve the old-host problem and the problem of multiple emulator versions under a single TERM name problem then? |
That's not a problem. Terminal doesn't matter, the only thing that matters is its capabilities. Nobody should be detecting things based on name.
Well I have no problem installing terminfos on my remotes. I don't disagree that there could be better solutions obviously, TERM itself is kinda crap, but you gotta be careful about just jumping on random existing escape sequences because most of them aren't used for good reasons. |
How it works is available at https://invisible-island.net/xterm/ctlseqs/ctlseqs.html .
This is used to query for terminfo features and not relying on the actual files. It's supported by notcursors, most modern terms, etc. It could be sort of good when you ssh into system without TERM info you have and it could help terminals not having their terminfo spread to work with at least modern toolkits.
The text was updated successfully, but these errors were encountered: