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

Git Bash on Windows renders control characters in setup #45

Closed
1 task done
Kwonunn opened this issue Nov 26, 2022 · 5 comments
Closed
1 task done

Git Bash on Windows renders control characters in setup #45

Kwonunn opened this issue Nov 26, 2022 · 5 comments
Labels

Comments

@Kwonunn
Copy link

Kwonunn commented Nov 26, 2022

Description

When first configuring hyfetch the terminal renders control characters instead of interpreting them:
image

This happens both in VSCode's integrated terminal as well as the Windows Terminal. Running in MinTTY does work:

image

After having actually run through the config, running the program does work for some reason...

image

I have looked through the source, but I can't fix it.

  • Does this issue still occur in the master branch? (Required if issue)

Neofetch version

Just fetched master

Config file

GlobalConfig(color_mode='rgb', override_distro=None, debug=True, is_light=False)

@hykilpikonna
Copy link
Owner

hykilpikonna commented Nov 27, 2022

hmm weird, git bash should be using mintty internally if I remember correctly, IDK why it is doing that.

Also, the color escape sequences used in the config screen should be the same with the actual rendering screen, just that the actual rendering is printed by bash while the config screen is printed by python... it might be some implicit conversion that git bash is doing.

Can you try running if each of these can print colors in git bash?

python3 -c "print('\033[1;33mTest Colors\033[0m;')"
bash -c "printf '\033[1;33mTest Colors\033[0m;'"

@Kwonunn
Copy link
Author

Kwonunn commented Nov 27, 2022

image
image

To me this seems like Python might be outputting 'raw' strings or something

@hykilpikonna
Copy link
Owner

Both work totally fine on Unix.

image

Since Windows' terminal emulator doesn't natively support Xterm color escape sequences but have its own set of color interface, I would guess that git bash is probably doing some implicit conversion, and since windows Python isn't doing the conversion, python output isn't colored on Windows.

I have no idea of how to work around this since I'm not familiar with how Windows cmd's color coding works... maybe we can try colorama's conversion?

pip install colorama
python3 -c "import colorama; colorama.just_fix_windows_console(); print('\033[1;33mTest Colors\033[0m;')"

@R3AP3
Copy link

R3AP3 commented Nov 28, 2022

this may be an issue with msys/mingw64... i had this problem with multicolor support for my msys shell on windows too and fixxed it by literally making pacman -Syu and that fixxed it.

randomly found this issue and it remembered me of that issue i had. This is not an issue with hyfetch mostlikely (even tho i never used it until now)

@Kwonunn
Copy link
Author

Kwonunn commented Nov 29, 2022

image
Colorama does work, so using that seems like a good fix

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants