summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorehuss <eric@huss.org>2018-03-26 13:42:48 -0700
committerAndrew Gallant <jamslam@gmail.com>2018-03-26 16:42:48 -0400
commit07713fb5c5563243566677fae21095e610d459f8 (patch)
tree1a34d443f7d28f02e8c9bdab2075aff015a79811
parentd7c9323a689239ac8b29baba63b1c3a26e12afda (diff)
termcolor: fix bold + intense colors in Win 10
There is an issue with the Windows 10 console where if you issue the bold escape sequence after one of the extended foreground colors, it overrides the color. This happens in termcolor if you have bold, intense, and color set. The workaround is to issue the bold sequence before the color. Fixes rust-lang/rust#49322
-rw-r--r--termcolor/src/lib.rs12
1 files changed, 6 insertions, 6 deletions
diff --git a/termcolor/src/lib.rs b/termcolor/src/lib.rs
index 81825898..4e4b0865 100644
--- a/termcolor/src/lib.rs
+++ b/termcolor/src/lib.rs
@@ -971,18 +971,18 @@ impl<W: io::Write> WriteColor for Ansi<W> {
fn set_color(&mut self, spec: &ColorSpec) -> io::Result<()> {
self.reset()?;
- if let Some(ref c) = spec.fg_color {
- self.write_color(true, c, spec.intense)?;
- }
- if let Some(ref c) = spec.bg_color {
- self.write_color(false, c, spec.intense)?;
- }
if spec.bold {
self.write_str("\x1B[1m")?;
}
if spec.underline {
self.write_str("\x1B[4m")?;
}
+ if let Some(ref c) = spec.fg_color {
+ self.write_color(true, c, spec.intense)?;
+ }
+ if let Some(ref c) = spec.bg_color {
+ self.write_color(false, c, spec.intense)?;
+ }
Ok(())
}