Browse Source

Reset color after writing message in colorize

Presently when you `^C` in `zola serve` it is painted with the same
color as the previous message. This PR always ensures to reset the color
in colorize, before writing the newline.
index-subcmd
Christopher Vittal Vincent Prouillet 5 years ago
parent
commit
319985add4
1 changed files with 2 additions and 1 deletions
  1. +2
    -1
      src/console.rs

+ 2
- 1
src/console.rs View File

@@ -42,8 +42,9 @@ pub fn error(message: &str) {
fn colorize(message: &str, color: &ColorSpec) { fn colorize(message: &str, color: &ColorSpec) {
let mut stdout = StandardStream::stdout(*COLOR_CHOICE); let mut stdout = StandardStream::stdout(*COLOR_CHOICE);
stdout.set_color(color).unwrap(); stdout.set_color(color).unwrap();
writeln!(&mut stdout, "{}", message).unwrap();
write!(&mut stdout, "{}", message).unwrap();
stdout.set_color(&ColorSpec::new()).unwrap(); stdout.set_color(&ColorSpec::new()).unwrap();
writeln!(&mut stdout).unwrap();
} }


/// Display in the console the number of pages/sections in the site, and number of images to process /// Display in the console the number of pages/sections in the site, and number of images to process


Loading…
Cancel
Save