janet-lang / janet

A dynamic language and bytecode vm
https://janet-lang.org
MIT License
3.52k stars 227 forks source link

Color not working on Windows 10 in janet.exe repl #1156

Closed sogaiu closed 1 year ago

sogaiu commented 1 year ago

It appears that since 6e9cde8a, color display isn't working so well via a cmd.exe or a powershell window.

**********************************************************************
** Visual Studio 2022 Developer Command Prompt v17.4.3
** Copyright (c) 2022 Microsoft Corporation
**********************************************************************
[vcvarsall.bat] Environment initialized for: 'x64'
C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools>janet
Janet 1.28.0-dev-local windows/x64/msvc - '(doc)' for help
repl:1:> {:a 1}
{:a 1}
repl:2:>

Both @kamisori and I have observed the above sort of thing (both on Windows 10, though with different janet builds). The latest commit I've seen it happen at is 909c9060.

With the commit immediately before (by date) or the parent of 6e9cde8a I see color fine.

A temporary work-around is to use ansicon which can be started via cmd.exe or a powershell window.

bakpakin commented 1 year ago

Interesting, this was supposed to make things more portable and help with Windows 7 issues. Perhaps it is better just control this with an environment variable or similar than people can modify - Microsoft's docs here are not obvious to me.

bakpakin commented 1 year ago

(We now have support for the NO_COLOR environment variable, but part of the issue was that the unicode support that worked for windows 10 was causing issues in older versions of Windows.

sogaiu commented 1 year ago

I tested 7acb5c6 and things work for me now :+1:

@kamisori How about for you?

kamisori commented 1 year ago

looks neat again :D

sogaiu commented 1 year ago

I'm going to close this issue then.

Thanks for the quick fix @bakpakin!