mirror of
https://github.com/BurntSushi/ripgrep.git
synced 2025-05-29 21:47:42 +02:00
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
This commit is contained in:
parent
d7c9323a68
commit
07713fb5c5
@ -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(())
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user