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

Out-ConsoleGridView doesn't handle ANSI escape sequences correctly #131

Closed
SteveL-MSFT opened this issue Dec 16, 2020 · 7 comments
Closed

Comments

@SteveL-MSFT
Copy link
Member

It appears that gui.cs may not support rendering ANSI escape sequences. In the meantime, if using pwsh 7.2+, Out-ConsoleGridView should use StringDecorated type to make sure all text is plain text.

https://twitter.com/Jaykul/status/1339064642715398150

@tig
Copy link
Collaborator

tig commented Jan 22, 2021

Tracking issue in gui.cs added: gui-cs/Terminal.Gui#1097

@migueldeicaza
Copy link

Why would gui.cs parse external escape sequences?

@tig
Copy link
Collaborator

tig commented Apr 29, 2021

Should be fixed by #141

@tig
Copy link
Collaborator

tig commented Jun 3, 2022

This is not fixed.

I now understand the issue. Terminal.Gui is simply rendering the characters presented. Thus OCGV shows them.

Because powershell now colorized things in gci (e.g. directories), simple commands like ls | ocgv are useless:

image

I am not sure what the right thing to do is. Is it expected that any Powershell function or cmdlet that takes piped input should look for and strip off ANSI escape sequences before displaying?

@tig
Copy link
Collaborator

tig commented Jun 3, 2022

Reading this: PowerShell/PowerShell#13071

I'm looking for StringDecorated and/or String.ToString(bool).

But since the cmdlet is currently built for PS 6.x, these aren't available?

Once I figure out how to access these, it should be trivial to fix this bug by changing the logic here to strip the ANSI from the input.

image

@SteveL-MSFT the APIs in the Issue above are not exposed publicly that I can see. What's the recommended way for a cmdlet to strip the ANSI off of input?

tig added a commit to tig/GraphicalTools that referenced this issue Jun 3, 2022
tig added a commit to tig/GraphicalTools that referenced this issue Jun 3, 2022
@tig
Copy link
Collaborator

tig commented Aug 3, 2022

Confimed fixed in the code currently in master:

image

@SteveL-MSFT
Copy link
Member Author

This fix should be in the release this month

andyleejordan added a commit that referenced this issue Aug 22, 2022
* Fixed #58: Multi-line commands rendering wrong
* Fixed #58 - Newlines in commands render incorrectly
* Added debug instructions to readme
* simplified stripping of newline/linefeed
* made column spacing tighter
* removed excess padding on right
* removed excess rows at bottom
* status bar wsa occluding window
* fixed build scripts to only build ocgv
* refactored to make logic more obvious
* removed orig files
* Updated references to latest Terminal.Gui
* Fixed #131 and upgraded to terminal.gui 1.6, pwsh 7.2, and net60
* supported .net and reverted change
* Fixes #131 - Out-ConsoleGridView doesn't handle ANSI escape sequences correctly
* removed border when minui is enabled
* re-implemented feature post merge screw up
* improve VS code build and debug support
* On exit, ensure only visible marked items are output
* Fixes 87
* Fixing crash when MinUi PR is merged
* Tweaked build to have a better test at end
* removed merge artifacts
* exclude .orig files (merge artifacts)

Co-authored-by: Tyler James Leonhardt <tylerl0706@gmail.com>
Co-authored-by: Andy Jordan <2226434+andschwa@users.noreply.github.com>
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 a pull request may close this issue.

3 participants