From 07713fb5c5563243566677fae21095e610d459f8 Mon Sep 17 00:00:00 2001 From: ehuss Date: Mon, 26 Mar 2018 13:42:48 -0700 Subject: 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 --- termcolor/src/lib.rs | 12 ++++++------ 1 file 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 WriteColor for Ansi { 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(()) } -- cgit v1.2.3