-
-
Notifications
You must be signed in to change notification settings - Fork 429
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
Ansi codes are not properly handled on Windows Terminal #939
Comments
I will submit a pull request shortly, but I want to document the issue here. Colorama documents that calling Someone already recognized that and added code in In After my changes, |
Getting this right always seemed way too complicated to me! Now it seems less complicated, thanks to your thorough explanation, so thanks a lot for sharing 🙂 |
For reference: tartley/colorama#306 |
@julie777 Thanks for your explanation but some part doesn't make sense to me. Can you kindly elaborate on that?
And I am also using Windows Terminal and it just works fine. From another look of the source code I think it might be caused by the second call to |
It gets called in termui.py because supports_ansi is true.
I understand, but if the code is not ever calling init (as above) then calling deinit doesn't have a purpose.
The init in termui.py never gets called on Windows Terminal because supports_ansi correctly identifies that Windows Terminal is running and supports ansi. It is the check for WT_SESSION below. Without my changes init only gets called once in symbols.py and that is what caused the problem.
Additional explanation When I started there was only one call to init actually being called, which was the one in symbols. When I talk about calling deinit, I am refering to terminal.py where it does the initialization of the terminal.
I ansi is supported it calls deinit() even though init was not called (at least after I took it out of symbols.) |
Correct, but |
I agree with you. I just don't see a reason to call it. I am sorry if I am not clear enough with my writing. |
The point here is to try not to modify the |
I understand your not wanting to change anything in the _vendor directory.
from |
@julie777 Because I didn't see any arguments supporting the necessity of removing the line.
As you said,
It will revert if Most importantly, I am also using Windows Terminal and it works normally, so I think the issue might not be as what you analyzed. I want to see a reason of "MUST", not "MAY" or "SHOULD", to change the code in |
@frostming During my testing I found that piping the output to I closed my previous pull request and opened a new one with a fix that works. I found a reference to the problem https://bugs.python.org/issue40134 I have run in multiple shells. I have created a new shell just before running pdm. It is always repeatable. Sorry for all the confusion. |
Please test if it still occurs on |
Still facing this issue in 2.1.2! |
I also get this on Windows. I have pdm 2.4.0. This is my
|
ANSI codes should be treated as ANSI-BBS standard at CP437 and the line drawing and special characters should be rendered correctly, which they are not currently doing. |
Make sure you run commands with
-v
flag before pasting the output.Steps to reproduce
run git bash in Windows Terminal
run
pdm -h
Actual behavior
Terminal codes are output raw.
Expected behavior
I expected output to be formatted and colored like it is in other environments.
Environment Information
The text was updated successfully, but these errors were encountered: