Open AlttiRi opened 2 years ago
Yes. It uses mintty 3.6.1.
It behaves the same way as Git-Bash with enabled "support for pseudo consoles" option.
I just integrated that new MinTTY version into Git for Windows' SDK.
Could you replace (as admin) C:\Program Files\Git\usr\bin\mintty.exe
with the version from the SDK and see whether that addresses your problem?
Nothing changed.
So, it possibly should be addressed to MinTTY authors?
Without "Enable experimental support for pseudo consoles."
option color is gray, but get_terminal_size
does not work.
With that option enabled the color is default one, but get_terminal_size
works correctly.
So, it possibly should be addressed to MinTTY authors?
Potentially. However, I have to report that the problem does not reproduce for me (this is with MinTTY v3.6.0 and pseudo console support enabled):
However, I have to report that the problem does not reproduce for me (this is with MinTTY v3.6.0 and pseudo console support enabled):
Just to make sure, are you using native python
through winpty
or Msys2 python
?
A thing made with Node.js works different that the same one made with Python. (In Git-Bash terminal)
Node.js in both cases shows the console sizes, but it has very poor colors (no 8-bit colors) and it ignores 2
too.
Python always shows proper colors, except for 2
with "pseudo consoles" option.
The console size is shows only with "pseudo consoles" option.
In WT the results of Node.js and Python are the same, everything is proper.
Node.js code:
const color = (code, text) => process.stdout.write("\u001B[" + code + "m" + text + "\u001B[0m\n");
color("34", "ANSI_BLUE-34");
color("1;31", "ANSI_RED_BOLD-1;31");
console.log("COMMON-TEXT; Sizes: " + process.stdout.columns + " " + process.stdout.rows);
color("2", "TEXT-2 (should be gray)");
color("38;5;208", "8bit-ORANGE-208");
color("38;5;99", "8bit-VIOLET-99");
color("38;5;92", "8bit-VIOLET-92");
color("38;5;245", "8bit-GRAY-245");
Python code:
import shutil, sys
def color(code, text):
sys.stdout.write("\u001B[" + code + "m" + text + "\u001B[0m\n")
sizes = shutil.get_terminal_size()
color("34", "ANSI_BLUE-34");
color("1;31", "ANSI_RED_BOLD-1;31");
print("COMMON-TEXT; Sizes:", sizes[0], sizes[1]);
color("2", "TEXT-2 (should be gray)");
color("38;5;208", "8bit-ORANGE-208");
color("38;5;99", "8bit-VIOLET-99");
color("38;5;92", "8bit-VIOLET-92");
color("38;5;245", "8bit-GRAY-245");
With "pseudo consoles":
Without:
Windows Terminal:
However, I have to report that the problem does not reproduce for me (this is with MinTTY v3.6.0 and pseudo console support enabled):
Just to make sure, are you using native
python
throughwinpty
or Msys2python
?
I am running Python from the Microsoft Store, not via winpty
.
A thing made with Node.js works different that the same one made with Python
You're probably calling this with node <script>.js
. However, node
is a shell alias to winpty node.exe
. If you run it via node.exe
, I bet that it works the same as Python.
I am running Python from the Microsoft Store, not via
winpty
.
I think we usually create a winpty
alias for python
. Could the pseudo console support be influencing winpty
s hidden console here?
Yes. node.exe
fixes 8-bit color.
Without the option:
With:
Python 3.9.9, Node.js v18.0.0 from their sites.
Well, I can fix it with alias node='node.exe'
in my ~/.bashrc
file.
But should Git-Bash use winpty
by default, especially with pseudo console option enabled?
BTW, winpty
works different with node.exe
and python.exe
:
Also some program start to use colors in their output with this option enabled. For example, yt-dlp, ffmpeg, pip. (While the colors should work even without that option.)
Also can I toggle Enable experimental support for pseudo consoles.
option without reinstalling the program?
Also can I toggle
Enable experimental support for pseudo consoles.
option without reinstalling the program?
Yes. Create /etc/git-bash.config
with the content MSYS=enable_pcon
to enable it, delete the file to disable it. And restart Git Bash after changing it.
I use
Bug
\u001B[2m
does not make a text gray.More info
Python script:
With enabled option "Enable experimental support for pseudo consoles."![Screenshot](https://user-images.githubusercontent.com/16310547/165407173-d054dd68-48a7-419b-9077-cb294da4ed54.png)
"\u001B[2m"
console color is ignored:Without this option (however,![Screenshot_3](https://user-images.githubusercontent.com/16310547/165407190-598a39f7-0bd4-4cee-9e1f-0043e6b96d04.png)
get_terminal_size
does not work in this case):Windows Terminal:![Screenshot_4](https://user-images.githubusercontent.com/16310547/165407208-ad9b99eb-9861-433a-904b-4454f554f515.png)
https://en.wikipedia.org/wiki/ANSI_escape_code#SGR_(Select_Graphic_Rendition)_parameters