Support ANSI colors in msys terminals. See #2807#11031
Support ANSI colors in msys terminals. See #2807#11031jhasse wants to merge 1 commit intorust-lang:masterfrom
Conversation
src/libextra/term.rs
Outdated
There was a problem hiding this comment.
Wouldn't it be cleaner to synthesize a TermInfo entry for ANSI terminals,- rather than hard-coding escapes into this file?
There was a problem hiding this comment.
The escapes would have to be hard coded in this TermInfo entry then anyway, wouldn't they?
It would probably be a cleaner solution, but I don't know enough Rust to implement that (correctly).
There was a problem hiding this comment.
Yes, TermInfo would be hard-coded, but at least all information would be in one place, not scattered across the Terminal class.
Also, this would open the door for other custom-detected terminal types, depending on the OS perhaps. For example, you could detect if Rust is running on top of libuv-based IO stack and have a TermInfo variant corresponding to escapes that libuv supports.
There was a problem hiding this comment.
You're right. I have a (much shorter) patch ready which uses this approach.
I will push it tomorrow after some more testing ;)
|
I'm more or less ok with this PR. But, could we convince upstream cygwin to include a terminfo entry? I'd like to remove this hack eventually. Hardcoding terminals is no good. |
|
Agreed. Keep in my mind that this is msys only (cygwin has terminfo Also wait for tomorrow, my new patch (using TermInfo struct) is cleaner :) |
|
Ok, sounds good. Thanks for taking this up! On Thu, Dec 19, 2013 at 10:23 AM, Jan Niklas Hasse <notifications@github.com
|
|
Done :) This time I force pushed instead of creating a new PR. This new patch also enables bold text and disables 16 colors (they were emulated using bold text). |
Enable ANSI colors if TERM is set to cygwin and terminfo is not available (msys terminal on Windows). See #2807
New lint [`needless_return_with_try`] Closes rust-lang#10902 Rather than having a config option, this will just suggest removing the "return"; if `try_err` is used as well, then it'll be added again but without the `?`. changelog: New lint [`needless_return_with_try`]
Enable ANSI colors if TERM is set to cygwin and terminfo is not available (msys terminal on Windows). See #2807