-
Notifications
You must be signed in to change notification settings - Fork 8.5k
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
Add support for DA2 and DA3 device attributes reports #6850
Conversation
For the record, I'm happy to consider returning a genuine version number in DA2 and some kind of ID in DA3 if that's preferable, but I thought we'd probably want to remain essentially anonymous. For more info on how these sequences are implemented and used, see issue #5836 (comment). |
So, it looks like xterm (344) responds to I know that Vim, as an example, uses the xterm version, but I don't know if it uses For what it's worth, I can't get that build of xterm to respond to Regardless; how much should we pretend to be xterm and how much should we not? Open question! |
I do like the idea of remaining anonymous; I don't want people taking dependencies (like vim has done with xterm) on our implementation details especially when they change so rapidly in Terminal (and so slowly in Windows). |
I see now that you literally covered everything I just said, in the comment I opened to "read after I wrote my comments". Sorry. 😬 |
Note that the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I swear, you get fewer comments on your code reviews than the team does. I'm always impressed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep. Wonderful. I agree with the "remaining anonymous" policy for now. We can always revisit in the future if need be, but once a version system is out there, it's almost impossible to retract.
Hello @DHowett! Because this pull request has the p.s. you can customize the way I help with merging this pull request, such as holding this pull request until a specific person approves. Simply @mention me (
|
🎉 Handy links: |
This PR adds support for the
DA2
(Secondary Device Attributes) andDA3
(Tertiary Device Attributes) escape sequences, which are standardVT queries reporting basic information about the terminal.
The Secondary Device Attributes response is made up of a number of
parameters:
have the capabilities of a VT100 (using code 0 for this is an XTerm
convention, since technically DA2 would not have been supported by a
VT100).
report their actual version number, but I thought it best we just
hardcode a value of 10 (the DEC convention for 1.0).
I've followed the convention of the later DEC terminals using 1 to
indicate the presence of a PC keyboard.
The Tertiary Device Attributes response was originally used to provide
a unique terminal identification code, and which some terminal emulators
use as a way to identify themselves. However, I think that's information
we'd probably prefer not to reveal, so I've followed the more common
practice of returning all zeros for the ID.
In terms of implementation, the only complication was the need to add an
additional code path in the
OutputStateMachine
to handle the>
and=
intermediates (technically private parameter prefixes) that thesesequences require. I've done this as a single method - rather than one
for each prefix - since I think that makes the code easier to follow.
VALIDATION
I've added output engine tests to make sure the sequences are dispatched
correctly, and adapter tests to confirm that they are returning the
responses we expect. I've also manually confirmed that they pass the
Test of terminal reports in Vttest.
Closes #5836