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

Improved output handling on Windows #196

Closed
wants to merge 2 commits into from
Closed

Improved output handling on Windows #196

wants to merge 2 commits into from

Conversation

ImportTaste
Copy link

@ImportTaste ImportTaste commented May 29, 2022

Uses the Windows API to set the ENABLE_VIRTUAL_TERMINAL_PROCESSING flag for proper ANSI code handling, based off discussion from https://stackoverflow.com/questions/36760127

Also sets convert=True in the colorama initialization. This seems to improve compatibility when redirecting/piping output, particularly for line breaks.

(PowerShell 7+ Note: When piping the output of tldr.py, you should have $PSStyle.OutputRendering set to ANSI if you want colors to display.)

Fixes #178

@ImportTaste ImportTaste changed the title Proper Windows ANSI handling Improved output handling on Windows May 29, 2022
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.

Display formatting not correct when used on PowerShell
2 participants