summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Cargo.toml1
-rw-r--r--src/main.rs6
2 files changed, 5 insertions, 2 deletions
diff --git a/Cargo.toml b/Cargo.toml
index 3d1a82d8..91dd2c4d 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -5,5 +5,6 @@ authors = ["Dan Davison <dandavison7@gmail.com>"]
edition = "2018"
[dependencies]
+console = "0.7.7"
parsepatch = "0.2.0"
syntect = "3.2"
diff --git a/src/main.rs b/src/main.rs
index bd669820..c9754fbf 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -2,6 +2,7 @@ use std::fmt::Write;
use std::io::{self, BufRead};
use std::path::Path;
+use console::strip_ansi_codes;
use syntect::easy::HighlightLines;
use syntect::highlighting::{Color, Style, ThemeSet};
use syntect::parsing::{SyntaxReference, SyntaxSet};
@@ -40,7 +41,8 @@ fn main() {
let mut have_printed_line: bool;
for _line in io::stdin().lock().lines() {
- let line = _line.unwrap(); // TODO: handle None
+ let raw_line = _line.unwrap(); // TODO: handle None
+ let line = strip_ansi_codes(&raw_line).to_string();
have_printed_line = false;
if line.starts_with("diff --") {
state = State::DiffMeta;
@@ -71,7 +73,7 @@ fn main() {
}
}
if !have_printed_line {
- println!("{}", line);
+ println!("{}", raw_line);
}
}
}