mixmastamyk / console

Comprehensive utility library for terminals. “Better… Stronger… Faster.”
GNU Lesser General Public License v3.0
34 stars 5 forks source link

Alacritty on Windows conflates bold,bright attributes on detection #8

Closed notaduck448 closed 1 month ago

mixmastamyk commented 3 years ago

Hi,

Console does support bold and bright-color attributes as separate, however you may need to configure your terminal to disable the bright color when using bold. The TERM variable may have some effect as well.

notaduck448 commented 3 years ago

Apologies for not being more specific earlier.

The terminal I'm using is alacritty 0.5.0, and it does support separating bold text from bright text.

image

The problem arises after importing the library. After doing so, my terminal is no longer able to differentiate between bright and bold (even when not directly using the library to format the text).

image

mixmastamyk commented 3 years ago

Learning more as I go.

There is also a troubleshooting part of the docs, but I don't think it will help here:

python -m console.demos -d
mixmastamyk commented 3 years ago

Perhaps the conhost probing console does on windows is affecting alacritty, I'm not sure.

I tried to run alacritty on my Win10 vm, but it refuses to run with "panicked re event loop".

mixmastamyk commented 3 years ago

I appear to be blocked by this: https://github.com/alacritty/alacritty/issues/313

And I won't have access to a real Windows box any time soon.

If you wanted to set the environment variable to avoid auto detection: PY_CONSOLE_AUTODETECT=0 and create the fg, fx, etc objects yourself (see docs) you could. Would be interesting to see if the problem still occurred.

If the issue no longer happens, starting normally (without the env variable) and commenting various parts of the detection would probably show where it happens. Detection starts in detection.py and it loads windows-specific stuff from windows.py.

Somewhat tedious however, for someone not working on it often.

notaduck448 commented 3 years ago

I tried setting the environment variable PY_CONSOLE_AUTODETECT to 0 and discovered that the issue no longer occurs, meaning I can print bold and bright text separately.

Ill look through the detection module and see if I can figure out where the problem happens.

mixmastamyk commented 3 years ago

Perhaps the Windows function that enables "VT Processing" tickles some compatibility mode?

mixmastamyk commented 3 years ago

Any luck? I might not be able to see the changes myself, but could possibly introduce some temporary functionality like another variable to diagnose the behavior. i.e. skip parts of detection. It would also be helpful to know if alacritty "scrapes" a legacy console like older terminal apps on Windows, or uses the new ConPTY approach.

If the above variable pinpointed anything I could opt alacrittty out of it on Windows. What does it use for the TERM* variables?

mixmastamyk commented 3 years ago

I added a check for TERM=alacritty on Windows before trying enable_vt_processing(). Perhaps it will help, I'm kinda flying blind.

Will need to install the pre-release version with pip install --pre -U console to try.