From 8514d4fbb45265c263c982d5107216eefb2017dc Mon Sep 17 00:00:00 2001 From: kennytm Date: Tue, 30 Jan 2018 03:14:55 +0800 Subject: [PATCH] termcolor: tweak reset escape Write `Ansi::reset()` using `\x1b[0m` instead of `\x1b[m`. This works around an AppVeyor bug: https://github.com/appveyor/ci/issues/1824 --- termcolor/src/lib.rs | 2 +- tests/tests.rs | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/termcolor/src/lib.rs b/termcolor/src/lib.rs index bcb534a1..94cc0bfe 100644 --- a/termcolor/src/lib.rs +++ b/termcolor/src/lib.rs @@ -973,7 +973,7 @@ impl WriteColor for Ansi { } fn reset(&mut self) -> io::Result<()> { - self.write_str("\x1B[m") + self.write_str("\x1B[0m") } } diff --git a/tests/tests.rs b/tests/tests.rs index 646b02fa..5f8fa2ec 100644 --- a/tests/tests.rs +++ b/tests/tests.rs @@ -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); }); @@ -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 = "\ -1: -2: -4: +1: +2: +4: "; assert_eq!(expected, lines); });