Skip to content

Commit

Permalink
termcolor: tweak reset escape
Browse files Browse the repository at this point in the history
Write `Ansi::reset()` using `\x1b[0m` instead of `\x1b[m`.

This works around an AppVeyor bug: appveyor/ci#1824
  • Loading branch information
kennytm authored and BurntSushi committed Jan 29, 2018
1 parent ed9150c commit 8514d4f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion termcolor/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -973,7 +973,7 @@ impl<W: io::Write> WriteColor for Ansi<W> {
}

fn reset(&mut self) -> io::Result<()> {
self.write_str("\x1B[m")
self.write_str("\x1B[0m")
}
}

Expand Down
8 changes: 4 additions & 4 deletions tests/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1134,7 +1134,7 @@ clean!(regression_428_color_context_path, "foo", ".",
let expected = format!(
"{colored_path}:foo\n{colored_path}-bar\n",
colored_path=format!(
"\x1b\x5b\x6d\x1b\x5b\x33\x35\x6d{path}\x1b\x5b\x6d",
"\x1b\x5b\x30\x6d\x1b\x5b\x33\x35\x6d{path}\x1b\x5b\x30\x6d",
path=path("sherlock")));
assert_eq!(lines, expected);
});
Expand Down Expand Up @@ -1178,9 +1178,9 @@ clean!(regression_599, "^$", "input.txt", |wd: WorkDir, mut cmd: Command| {
// Technically, the expected output should only be two lines, but:
// https://github.com/BurntSushi/ripgrep/issues/441
let expected = "\
[m1[m:[m[31m[m
[m2[m:[m[31m[m
[m4[m:
[0m1[0m:[0m[31m[0m
[0m2[0m:[0m[31m[0m
[0m4[0m:
";
assert_eq!(expected, lines);
});
Expand Down

0 comments on commit 8514d4f

Please sign in to comment.