Pseudocosole output reader #11931

Closed
opened 2026-01-31 03:01:24 +00:00 by claunia · 1 comment
Owner

Originally created by @VE-2016 on GitHub (Jan 1, 2021).

Hello,

The issue concerns pseudoconsole output, as taken from https://github.com/microsoft/terminal/tree/main/samples/ConPTY/MiniTerm

I would like to read output pipe from pseudoconsole to byte array - and it has been done.

After reading from output pipe - I am receiving for example the following line:

"\u001b[2J\u001b[m\u001b[HMicrosoft Windows [Version 10.0.19042.685]\u001b]0;C:\WINDOWS\SYSTEM32\cmd.exe\a\u001b[?25h"

Now, I would like to retrieve here proper string - together with all required information, for example foreground colors of chars etc. - so as to be able to send it to RichTtextBox control (not to application console).

How to achieve this aim? Is there any information and documentation?

Best regards,
JK

Originally created by @VE-2016 on GitHub (Jan 1, 2021). Hello, The issue concerns pseudoconsole output, as taken from https://github.com/microsoft/terminal/tree/main/samples/ConPTY/MiniTerm I would like to read output pipe from pseudoconsole to byte array - and it has been done. After reading from output pipe - I am receiving for example the following line: "\u001b[2J\u001b[m\u001b[HMicrosoft Windows [Version 10.0.19042.685]\u001b]0;C:\WINDOWS\SYSTEM32\cmd.exe\a\u001b[?25h" Now, I would like to retrieve here proper string - together with all required information, for example foreground colors of chars etc. - so as to be able to send it to RichTtextBox control (not to application console). How to achieve this aim? Is there any information and documentation? Best regards, JK
claunia added the Issue-QuestionNeeds-Tag-FixResolution-Answered labels 2026-01-31 03:01:24 +00:00
Author
Owner

@DHowett commented on GitHub (Jan 1, 2021):

Hey! Thanks for reaching out. To get text and formatting information out of the ConPTY stream, you'll need a VT parser. The embedded control sequences follow the standards laid out in the docs on that page and this one (which includes the aforementioned docs plus information about xterm-specific control sequences).

I do not know if there's a preexisting VT->RichText parser, but hopefully this puts you on the right track.

Feel free to ask any followup questions!

@DHowett commented on GitHub (Jan 1, 2021): Hey! Thanks for reaching out. To get text and formatting information out of the ConPTY stream, you'll need a [VT parser](https://vt100.net/emu/dec_ansi_parser). The embedded control sequences follow the standards laid out in the docs on that page and [this one](https://invisible-island.net/xterm/ctlseqs/ctlseqs.html) (which includes the aforementioned docs plus information about xterm-specific control sequences). I do not know if there's a preexisting VT->RichText parser, but hopefully this puts you on the right track. Feel free to ask any followup questions!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#11931