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 a spec for an In-process ConPTY #17387

Merged
merged 6 commits into from
Jul 30, 2024
Merged

Add a spec for an In-process ConPTY #17387

merged 6 commits into from
Jul 30, 2024

Conversation

lhecker
Copy link
Member

@lhecker lhecker commented Jun 7, 2024

👉 Preview: https://github.com/microsoft/terminal/blob/dev/lhecker/13000-spec/doc/specs/%2313000%20-%20In-process%20ConPTY.md

The spec has a tl;dr! The tl;dr^2 for the commit message:

  • Less bugs
  • Less code
  • More perf

@lhecker lhecker marked this pull request as ready for review June 7, 2024 15:39

This comment has been minimized.

Copy link
Member

@zadjii-msft zadjii-msft left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We talked about this ad nauseum in a spec review a little while back. I think you sorted me out on the questions I had. Thanks!

They should also always be below the current prompt line so that we don't need to perform a potentially lossy backup/restore operation.

The `--vtmode xterm-ascii` switch exists for the telnet client as it only supports ASCII as per RFC854 section "THE NVT PRINTER AND KEYBOARD".
However, telnet is the only user of this flag and it's trivial to do there (for instance by stripping high codepoints in `WriteOutputToClient` in `telnet/console.cpp`), so there's no reason for us to keep this logic in the new code.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what happens when an out-of-date telnet client connects to an updated win11 machine with the new conpty, with the high codepoints in the output?

Copy link
Member Author

@lhecker lhecker Jul 17, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not entirely sure if I understand how telnet on Windows in particular works, but if you check out VtConsole.cpp in the OS repo you can see how it explicitly CreateProcess'es conhost.exe --vtmode ascii ... and then connects its local pipes to it to then pump the contents somewhere else. This means we can definitely filter the output there, after reading from ConPTY and before sending it somewhere else.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess that means VtConsole.cpp is effectively part of the telnet server? In that case it'll definitely work, because telnet and inbox conpty are updated effectively in lockstep, right?

### Discussion

The idea is that we can translate Console API calls directly to VT at least as well as the current VtEngine setup can.
For instance, a call to `SetConsoleCursorPosition` clearly translates directly to a `CUP` escape sequence.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Presumably, we're keeping the assumption that things running in ConPTY 2 still have the buffer size clamped to the viewport, correct?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Initially yes (in this step), but later on we won't (goal 2 and beyond). The new low level layer ("in-process ConPTY") will allow the terminal to specify the area that constitutes the addressable buffer range. ConPTY would basically make it equal the VT viewport (VT == buffer), Windows Terminal would pretend it would equal the VT viewport (VT == buffer, but we also have scrollback), and conhost would allow the entire 120x9001 buffer to be addressed (VT viewport is just a part of the buffer).

@DHowett DHowett merged commit d730cfd into main Jul 30, 2024
18 of 20 checks passed
@DHowett DHowett deleted the dev/lhecker/13000-spec branch July 30, 2024 16:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

The long road to an In-process ConPTY
3 participants