-
Notifications
You must be signed in to change notification settings - Fork 13.1k
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
Support Windows in extra::term #2807
Comments
This is easier to do now that it has been refactored to support 8-color terminals and handle terminfo properly. Aetherspawn in IRC started work on this. |
Updated issue title to reflect std->extra |
Windows console does not support escape codes. In order to change colors one must use console API functions, such as SetConsoleTextAttribute. Unfortunately these require console handle, but there no obvious way to extract a file handle from io::Writer. I suppose we could implement @alexcrichton: any other ideas? |
Hi! I tried to fix this and noticed that the msys terminal supports ANSI colors but msys doesn't come with terminfo. So this patch tries to figure out if it is run from a msys terminal (env var TERM is cygwin, since msys is a modified fork of an older cygwin version) and then enables colors. Here is a screenshot of my patch in action: https://www.dropbox.com/s/mi7gxp94ilkis60/Screenshot%202013-12-17%2008.39.48.png Strangely this also works with cmd.exe on my system. Maybe because I have msysgit installed? I don't know how to detect this though: https://www.dropbox.com/s/tvk5hd3n8ur4cnd/Screenshot%202013-12-17%2008.42.09.png Sorry if there are issues in my patch, I'm very new to Rust and unfamiliar with the language. |
@jhasse rust's stdio uses libuv's tty interface. libuv implements some ANSI color parser, so I guess that |
@klutzy Cool, so this means it should work on all Windows systems out of the box, right? |
We only use libuv in M:N mode, with libgreen. We shouldn't depend on the On Tue, Dec 17, 2013 at 3:36 AM, Jan Niklas Hasse
|
Okay I've reverted the change for cmd.exe. This new patch should now only change something for the msys terminal on windows. |
Enable ANSI colors if TERM is set to cygwin and terminfo is not available (msys terminal on Windows). See #2807
Okay my patch has been merged, here are some of the things I found out, if anyone wants to work on cmd.exe/cygwin support:
Colored output in cygwin doesn't work because of this check: https://github.com/mozilla/rust/blob/master/src/libsyntax/diagnostic.rs#L205 Side note: I just opened up this awesome PowerShell: An ugly looking window came up with non anti-aliased text and no colors at all. I can't even resize it properly - LOL. Microsoft == failure. My advice for anyone: Use ConEmu with msys ;) |
Closed by 5cf2f54 |
Strictly speaking MSys terminal != Windows console. The fix in 5cf2f54 won't work, unless one uses mingw shell. |
Ah, I take it back then! |
Versions of clippy that come with newer toolchains report a large number of needless_borrows_for_generic_args. We can address these now so that we don't have to make these changes as part of a toolchain update.
Do it. Do it now. (Or at least sometime.)
The text was updated successfully, but these errors were encountered: