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

Enable colored output on Windows #11020

Closed
wants to merge 2 commits into from
Closed

Conversation

jhasse
Copy link
Contributor

@jhasse jhasse commented Dec 17, 2013

Enables 16 color terminal support if terminfo isn't supported and one of the following conditions is met:

  • The environment variable TERM is NOT definied, but libc::isatty returns something >0 (e.g. cmd.exe).
  • The environment variable TERM is "cygwin" (e.g. msys terminal).
  • The environment variable TERM starts with "xterm" (e.g. cygwin's mintty terminal).

Fixes #2807 except for attributes other than ForegroundColor and BackgroundColor.

None => {
let number = if bg { color + 10 } else { color };
let ansi = if number < 8 {
format!("\x1b[{}m", 30 + number)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we really want to be hard-coding colour escapes? Doesn't this code path get taken whenever rustc is connected to a tty, even if we don't know how it handles colours?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AFAIK there's no other way since msys doesn't tell you the escape codes.

Regarding the second question see my comment above.

@jhasse
Copy link
Contributor Author

jhasse commented Dec 17, 2013

@huonw Okay based on your suggestion I've created a new pull requests which gets rid of the isatty part and only enables ANSI color for the msys terminal: #11028

@jhasse jhasse closed this Dec 17, 2013
@jhasse jhasse deleted the patch-msys branch December 17, 2013 16:41
flip1995 pushed a commit to flip1995/rust that referenced this pull request Jul 2, 2023
New lint [`tuple_array_conversions`]

Closes rust-lang#10748

PS, the implementation is a bit ugly 😅 ~~I will likely refactor soon enough :)~~ Done :D

changelog: New lint [`tuple_array_conversions`]
matthiaskrgr pushed a commit to matthiaskrgr/rust that referenced this pull request Feb 11, 2024
…tic, r=Veykril

feat: Add diagnostic with fix to replace trailing `return <val>;` with `<val>`

Works for functions and closures.
Ignores desugared return expressions (e.g. from desugared try operators).

Fixes: rust-lang#10970
Completes: rust-lang#11020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support Windows in extra::term
2 participants