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

Document the resize quirk for ConPTY #16911

Closed
Tracked by #15065
Unit2795 opened this issue Mar 21, 2024 · 6 comments · Fixed by #17510
Closed
Tracked by #15065

Document the resize quirk for ConPTY #16911

Unit2795 opened this issue Mar 21, 2024 · 6 comments · Fixed by #17510
Labels
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-Conpty For console issues specifically related to conpty

Comments

@Unit2795
Copy link

Unit2795 commented Mar 21, 2024

Description of the new feature/enhancement

When I issue a ResizePseudoConsole call, if the buffer is changing from a smaller size to a larger one, ConPTY outputs the reflowed buffer and overwrites any content currently in the terminal. If there were 50 lines of output, the buffer size was 24 lines, and I resize to 30 lines, the output will be overwritten with 24 lines. (The amount of content in the buffer at the time of the resize).

Proposed technical implementation details

Possible Solutions:

  1. Add the ability to disable the automatic output of the reflowed buffer
  2. Add ability to specify differing buffer and window sizes for ConPTY, such that the window size will ensure VT sequences are emitted in sync with the terminal ConPTY may be connected to and therefore output looks visually correct. While also allowing a scrollback buffer to be maintained and reflowed as needed.
    • Example Pseudocode:

      CreatePseudoConsole(windowSize, bufferSize, hInput, hOutput, dwFlags, phPC)
      

Related

@Unit2795 Unit2795 added the Issue-Feature Complex enough to require an in depth planning process and actual budgeted, scheduled work. label Mar 21, 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 Mar 21, 2024
@zadjii-msft
Copy link
Member

in lieu of a longer, more thorough response:

That's in the OpenConsole version of conpty. I forget if we shipped that to the OS conpty. We never really documented it cause it felt like a hack at the time, but we've been using for a few years now. Also I think we assumed that a caller who passed that would need to reflow their own buffer in the exact same way, to keep things in sync.

But that might be helpful to experiment with?

@Unit2795
Copy link
Author

Unit2795 commented Mar 22, 2024

I saw this flag mentioned in another issue (I can't recall which one). I gave it a try but it had no effect, it doesn't appear to be in my OS version. I'll research obtaining the openconsole version. If I can get the resize quirk working I will just have to do my own reflow. My library shows a terminal quite a while after ConPTY has begun producing output, so I have to reflow my own buffer contents. Perhaps I could mimic the reflow capability from this repo's TextBuffer::Reflow?

@Unit2795
Copy link
Author

Unit2795 commented Mar 25, 2024

For anyone who may be curious, I managed to obtain the ConPTY.dll and OpenConsole.exe prebuilt from this link (https://dev.azure.com/ms/terminal/_build?definitionId=136&branchFilter=26987%2C26987%2C26987%2C26987) by finding the latest build for the main branch, then found the Build x64 stage's build-x64-Release.zip artifact and downloaded it.

2024-03-25_02-07-35
2024-03-25_02-07-57
2024-03-25_02-08-56

@Unit2795 Unit2795 changed the title Resizing ConPTY: Add option to disable reflow re-output, add programmatic reflow Reflowing ConPTY: Add programmatic reflow & plain-text render Mar 27, 2024
@Unit2795
Copy link
Author

After downloading the latest ConPTY.dll, PSEUDOCONSOLE_RESIZE_QUIRK did work. Thank you for pointing this out @zadjii-msft . I've since adjusted this issue to remove the request for disabling reflow output. I did add another request for a possible plain-text render feature as it seemed like it could be related to my request for programmatic reflow. If I need to break that out into another issue I can do that.

@zadjii-msft
Copy link
Member

zadjii-msft commented Mar 27, 2024

Okay, thanks for trying that out! I'd also caution - it's called the "quirk" because it's expecting the hosting terminal application to be able to reflow their own buffer in the same way conpty does. No one else has really tried that out, so do send feedback if you collect any.

For now, I'm gonna convert this issue into "document and ship this". Thanks!

(also linked up to #15065 which is what we're using for actually shipping conpty)

@zadjii-msft zadjii-msft added Product-Conpty For console issues specifically related to conpty 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. Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting labels Mar 27, 2024
@zadjii-msft zadjii-msft changed the title Reflowing ConPTY: Add programmatic reflow & plain-text render Document the resize quirk for ConPTY Mar 27, 2024
@Unit2795
Copy link
Author

Unit2795 commented Apr 1, 2024

Since this is now serving as the issue for documenting the resize quirk, I've moved the request for programmatic reflow and plain-text rendering to this issue:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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-Conpty For console issues specifically related to conpty
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants