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

Add support for the S8C1T/S7C1T escape sequences #17931

Closed
j4james opened this issue Sep 17, 2024 · 2 comments · Fixed by #17945
Closed

Add support for the S8C1T/S7C1T escape sequences #17931

j4james opened this issue Sep 17, 2024 · 2 comments · Fixed by #17945
Labels
Area-VT Virtual Terminal sequence support In-PR This issue has a related PR Issue-Feature Complex enough to require an in depth planning process and actual budgeted, scheduled work. Product-Terminal The new Windows Terminal.
Milestone

Comments

@j4james
Copy link
Collaborator

j4james commented Sep 17, 2024

Description of the new feature/enhancement

The S8C1T and S7C1T commands enable an application to choose whether the terminal should use C1 controls when sending key sequences and query responses. For example, instead of encoding a CSI prefix as ESC [, the terminal would use a single CSI codepoint (i.e. U+009B).

Back in the days of the 8-bit hardware terminals, this had the advantage of being slightly more efficient (your sequence introducers would take 1 byte rather than 2). And another bonus was that it made it easy to distinguish an Esc key (assuming your keyboard had one) from other key sequences that merely started with the ESC character.

However, these days you're more likely to be using a UTF-8 encoding, in which case a C1 control character is still going to occupy two bytes, so there is no advantage in terms of sequence length. And the ability to distinguish an Esc key from other key sequences is somewhat diminished by the modern usage of ESC as a prefix for Alt key combinations.

In short, there's probably not much demand for this functionality outside of people wanting to connect to legacy systems, but it would be nice to have just for completeness sake (it's a requirement for VT level 2 conformance).

Proposed technical implementation details (optional)

Some of the framework for the key sequence encoding was already added in PR #16511, so that just needs to be hooked up to a new input mode which can be toggled by the S8C1T and S7C1T escape sequences. We need to do something similar in AdaptDispatch for all the query responses, but that's also fairly straightforward.

However, if we want to support 8-bit C1 sequences, as used in legacy systems, we also need a way to switch the input code page from UTF-8 to something that can cleanly pass through 8-bit bytes (like ISO-8859-1). Fortunately we already have a DOCS escape sequence which sets the output code page to ISO-8859-1, and I think it's reasonable to extend that to set the input code page at the same time.

The catch is that this won't work in a WSL shell, because WSL doesn't pay any attention to the input code page. And while it is potentially usable from a Windows shell, the typical use case will involve connecting to a remote system, which means you're going to ned a ssh or telnet client that is 8-bit capable (and I think that rules out the Windows inbox clients).

The bottom line is there are a few hoops you need to jump through to get this to work. Given these limitations, is it still worth adding?

@j4james j4james added the Issue-Feature Complex enough to require an in depth planning process and actual budgeted, scheduled work. label Sep 17, 2024
@microsoft-github-policy-service microsoft-github-policy-service bot added Needs-Tag-Fix Doesn't match tag requirements Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting labels Sep 17, 2024
@microsoft-github-policy-service microsoft-github-policy-service bot added the In-PR This issue has a related PR label Sep 21, 2024
@lhecker
Copy link
Member

lhecker commented Sep 23, 2024

Given these limitations, is it still worth adding?

Personally, I'd add it if there's need for it or if it enables new use-cases. But I'm also fine with this:

[...] but it would be nice to have just for completeness sake (it's a requirement for VT level 2 conformance).

@DHowett
Copy link
Member

DHowett commented Sep 24, 2024

I am A-OK with "completeness sake", even if there are limitations and some minor hoops for applications to jump through.

@carlos-zamora carlos-zamora added Area-VT Virtual Terminal sequence support Product-Terminal The new Windows Terminal. and removed 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 Sep 25, 2024
@carlos-zamora carlos-zamora added this to the Backlog milestone Sep 25, 2024
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 In-PR This issue has a related PR Issue-Feature Complex enough to require an in depth planning process and actual budgeted, scheduled work. Product-Terminal The new Windows Terminal.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants