mirror of
https://github.com/denoland/deno.git
synced 2024-12-22 15:24:46 -05:00
Fix unwanted ANSI Reset Sequence (#4268)
This commit is contained in:
parent
9a63902db5
commit
e81fb25b7a
1 changed files with 4 additions and 3 deletions
|
@ -35,11 +35,12 @@ pub fn enable_ansi() {
|
|||
}
|
||||
|
||||
fn style(s: &str, colorspec: ColorSpec) -> impl fmt::Display {
|
||||
if !use_color() {
|
||||
return String::from(s);
|
||||
}
|
||||
let mut v = Vec::new();
|
||||
let mut ansi_writer = Ansi::new(&mut v);
|
||||
if use_color() {
|
||||
ansi_writer.set_color(&colorspec).unwrap();
|
||||
}
|
||||
ansi_writer.set_color(&colorspec).unwrap();
|
||||
ansi_writer.write_all(s.as_bytes()).unwrap();
|
||||
ansi_writer.reset().unwrap();
|
||||
String::from_utf8_lossy(&v).into_owned()
|
||||
|
|
Loading…
Reference in a new issue