Skip to content
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

Update the Device Attributes report #14491

Closed
j4james opened this issue Dec 4, 2022 · 2 comments · Fixed by #14906
Closed

Update the Device Attributes report #14491

j4james opened this issue Dec 4, 2022 · 2 comments · Fixed by #14906
Labels
Area-VT Virtual Terminal sequence support Help Wanted We encourage anyone to jump in on these. In-PR This issue has a related PR Issue-Task It's a feature request, but it doesn't really need a major design. Needs-Tag-Fix Doesn't match tag requirements Product-Conhost For issues in the Console codebase
Milestone

Comments

@j4james
Copy link
Collaborator

j4james commented Dec 4, 2022

Description of the new feature/enhancement

Up to now, we've been identifying as a VT100, since we haven't fully met the conformance requirements for any of the higher level devices. But with the recent support that's been added for several VT extensions, I think it's time to consider an updated DA response.

The structure of a DA report is as follows: the first parameter value indicates the conformance level with a number in the range 61 to 69 (representing levels 1 to 9); subsequent parameters indicate the supported feature extensions. The early VT terminals didn't follow this standard, but their initial DA parameter would have always been below 60.

We still don't meet the requirements for level 2, so the first parameter in our DA response will have to be 61. But we do now support a number of feature extensions, which we can indicate with additional parameter values. Some of the more useful ones include:

7 = Soft Fonts (since PR #13965)
28 = Rectangular Editing (since PR #14285)
32 = Text Macros (since PR #14402, if accepted)

Applications that wish to take advantage of these features would be able to do so automatically if they could tell from the DA report that the terminal supported the necessary extensions.

Proposed technical implementation details (optional)

Updating the DA report seems like it ought to be a trivial change. However, the complication for us is this it's handled on the conhost side, but it needs to take into account the capabilities of the conpty client. For example, conhost supports Soft Fonts, but they won't work over conpty unless the conpty client also supports them (and for Terminal that's dependent on the configured renderer).

My proposed solution for this is that we fire off a DA request to the conpty client on startup (similar to the way we sometimes send a CPR request on startup). We then save the relevant information from the client's response (for now just the Soft Font support), and use that to determine what features we can include in our DA response.

Does that seem like a reasonable approach to take?

@j4james j4james added the Issue-Feature Complex enough to require an in depth planning process and actual budgeted, scheduled work. label Dec 4, 2022
@ghost ghost added Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting Needs-Tag-Fix Doesn't match tag requirements labels Dec 4, 2022
@zadjii-msft zadjii-msft added Product-Conhost For issues in the Console codebase Help Wanted We encourage anyone to jump in on these. Area-VT Virtual Terminal sequence support Issue-Task It's a feature request, but it doesn't really need a major design. and removed Issue-Feature Complex enough to require an in depth planning process and actual budgeted, scheduled work. labels Dec 12, 2022
@ghost ghost removed the Needs-Tag-Fix Doesn't match tag requirements label Dec 12, 2022
@zadjii-msft zadjii-msft added this to the Backlog milestone Dec 12, 2022
@zadjii-msft zadjii-msft removed the Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting label Dec 12, 2022
@zadjii-msft
Copy link
Member

Seems sensible to me, though, we might want to be careful to be sure that the client can reply. Maybe we should gate it on --inheritCursor? er. Maybe not. There was some WSL issue IIRC that precipitated the need for --inheritCursor, rather than passing it all the time. Like, some scenarios where there was nothing actually processing the input, so if ConPTY just waits on startup for a reply, conpty might just HANG if no one ever replies. We might need some sort of timeout on startup to have conpty bail if conpty fires off a DA and doesn't get a response.

Maybe we could just not block startup on this. Fire off the DA, and just keep going. If we get a reply, then great, if not, then just keep 'er movin.

@j4james
Copy link
Collaborator Author

j4james commented Dec 12, 2022

Maybe we should gate it on --inheritCursor? er. Maybe not.

Yeah, --inheritCursor isn't an option since it doesn't seem to get used most of the time, and this has to be called every time if we want it to work correctly every time.

We might need some sort of timeout on startup to have conpty bail if conpty fires off a DA and doesn't get a response.

That kind of sucks, because if that really is necessary, we're again left with a solution that isn't going to work some of the time. And any apps that rely on the DA information being correct are going to then have inconsistent behavior - sometimes they'll work and sometimes they won't.

I'd love to know under what conditions this is expected to fail, and whether that's fixable. Like could we maybe delay sending the DA request until the client has reached a certain steady state?

@microsoft-github-policy-service microsoft-github-policy-service bot added the In-PR This issue has a related PR label Feb 25, 2023
DHowett pushed a commit that referenced this issue Apr 26, 2023
This is an update of our Primary Device Attributes report, which better
indicates the feature extensions that we now support.

## Detailed Description of the Pull Request / Additional comments

This first parameter of the response is 61, representing a conformance
level of 1. The subsequent parameters identify the supported feature
extensions.

1 = 132 column mode
6 = Selective erase
7 = Soft fonts
22 = Color text
23 = Greek character sets
24 = Turkish character sets
28 = Rectangular area operations
32 = Text macros
42 = ISO Latin-2 character set

Most of these features are handled entirely within `AdaptDispatch`, so
they apply to all clients. However, 132 column mode is only supported by
ConHost, so we don't report that for conpty clients.

And note that soft fonts won't necessarily work in all conpty clients,
but we don't have an easy way of determining that, so we just report
soft font support for everyone.

## Validation Steps Performed

I've manually verified that the `DA1` report is returning the expected
response in Vttest, both from ConHost and Windows Terminal.

I've also updated the `DeviceAttributesTests` in the adapter tests to
account for the new expected response.

Closes #14491
@microsoft-github-policy-service microsoft-github-policy-service bot added the Needs-Tag-Fix Doesn't match tag requirements label Apr 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-VT Virtual Terminal sequence support Help Wanted We encourage anyone to jump in on these. In-PR This issue has a related PR Issue-Task It's a feature request, but it doesn't really need a major design. Needs-Tag-Fix Doesn't match tag requirements Product-Conhost For issues in the Console codebase
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants