Comments (3)
Blocked by #14
from taskranger.
This turned into a rabbit hole reeeeeally fast. I noticed ANSI isn't stripped when I pipe stuff into files, which means I end up with files containing ANSI. That might not be the biggest problem ever per se, but it's kinda sorta pointless and easily fixable with one check.
So the takeaway from this mess is:
- SetConsoleMode fails (WOOHOO!) if ANSI isn't supported. This happens at runtime, and it happens controlled.
- Detecting terminals is a mess
- We need to make assumptions
One of said assumptions is that anyone with access to a C++17 compiler also has access to a half-decent ANSI-supported terminal. Feel free to prove me wrong with a PR disabling ANSI for whatever terminal that could be.
The second assumption is that the first assumption applies if /dev/null (yes, really) exists. MinGW and Cygwin both come with this, Linux and Mac does too. This means that, at runtime, we have a roughly accurate measure on Windows to determine Bash from cmd/powershell.
SetConsoleWhateverISaid failing also means we have an accurate way to tell whether cmd ansi is supported or not. Windows being extremely uniform fortunately makes testing there easy; Mac, Linux, and UNIXes are more complicated in terms of terminal support, because there's so many more terminals.
Of course, there's a chance some of these assumptions are wrong, in which case, that needs to be addressed. The main difference between individual cases and what I'm doing now is that I'll actually have something to reference. "Look at everything" is not a good starting point, so there's no other good alternatives
That being said, there's also a chance this doesn't work if mingw/cygwin doesn't support Windows' _isatty
function, so that's fun. I don't run Windows, nor do I have a chance of checking this, soooooo yeah.
from taskranger.
Gonna close this for now and assume it's hacked together good enough. Will rather deal with other ANSI issues on Windows and other systems when they become a problem
from taskranger.
Related Issues (10)
- Ongoing: Windows compatibility HOT 2
- Auto-generate CHANGELOG.md
- Fix GitHub action duplication HOT 1
- Windows support is gone: MSVC's JIT bullshit is fucking over the CI tests HOT 1
- Release mode, and the CI, are temporarily broken HOT 2
- Installation HOT 2
- Updating SCons from 3.1.2 to 4.0.0 is broken HOT 1
- Bump Catch2 to 3.0.0
- The CI is failing and I have no idea why HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from taskranger.