-
Notifications
You must be signed in to change notification settings - Fork 8.2k
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
Reflowing ConPTY: Add programmatic reflow & plain-text render #16985
Comments
Thank you so much for your excellent issue! Unfortunately, after discussion, we have decided that we want to pursue a different direction at this time. Even if we were to expose ConPTY's reflow algorithm in some way, it still wouldn't solve the issue for those terminals that have their own text storage and thus necessarily their own reflow algorithms. Instead we want to solve the issue in these ways:
Regarding |
No problem @lhecker, I figured there were more important things to focus on at the moment anyways and my proposed solutions may have not been the best route. But I wanted to get the request out there. You're right that part of my issue is Being able to supply your own buffer sounds like another good possible solution. I'm not familiar enough with low level terminal emulation and the Win32 APIs to say what might be best, so I'm sure you guys will pick what's best. My use case for extracting plain text from VT sequences, as they would appear in the console, is mentioned briefly above:
My particular use-case is producing log files and regex-matching console output in my terminal automation library. Very similar to the "Export Text" option currently available in Windows Terminal, but programmatically (mentioned in this discussion #16504). I could probably just use ReadConsoleOutputCharacter but my only issue is sometimes I need to produce this plain-text after the console has already closed. Similar to producing plain text; RTF and HTML would be great too, possibly similar to:
Thanks for the reply and consideration, looking forward to seeing what comes next. |
Description of the new feature/enhancement
Synopsis:
Both of these already seem to be part of the library but are not documented or exposed publicly.
terminal/src/buffer/out/textBuffer.cpp
Line 2527 in de7f931
terminal/src/buffer/out/textBuffer.cpp
Line 2053 in de7f931
Description
Reflow
Applications may maintain their own buffer/scrollback history that is larger than the buffer size of ConPTY. Issuing ResizePseudoConsole alone may not be adequate in this case (or if reflow output is disabled using
PSEUDOCONSOLE_RESIZE_QUIRK
). A function where you provide text containing VT sequences along with from/to character grid dimensions and receive the reflowed output would be useful.TextBuffer::Reflow
may already suffice?Plain-text Render
Much like ReadConsoleOutputCharacter where you can read the characters in a console. A function where you supply text containing VT sequences, have it rendered, and receive the plain-text output as it would appear in the console would be useful for display in situations where plain text is the only option.
Use-cases
Proposed technical implementation details (optional)
Possible Solutions:
Add a function that exposes the reflow capability of ConPTY. Taking an input string containing VT sequences, an original terminal size, and a desired terminal size; and outputting the reflowed text. Though since the buffer may be larger than the desired size (such as a scrollback history with thousands of lines) some special precautions may need to be taken?
Example Pseudocode:
Add a function that renders text containing VT sequences into plain text:
Example Pseudocode:
Related
The text was updated successfully, but these errors were encountered: