|
|
@ -114,9 +114,13 @@ impl<'a> InteractivePrinter<'a> {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Get the Git modifications
|
|
|
|
// Get the Git modifications
|
|
|
|
let line_changes = match file {
|
|
|
|
let line_changes = if config.output_components.changes() {
|
|
|
|
InputFile::Ordinary(filename) => get_git_diff(filename),
|
|
|
|
match file {
|
|
|
|
_ => None,
|
|
|
|
InputFile::Ordinary(filename) => get_git_diff(filename),
|
|
|
|
|
|
|
|
_ => None,
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
None
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
// Determine the type of syntax for highlighting
|
|
|
|
// Determine the type of syntax for highlighting
|
|
|
@ -210,11 +214,8 @@ impl<'a> Printer for InteractivePrinter<'a> {
|
|
|
|
line_buffer: &[u8],
|
|
|
|
line_buffer: &[u8],
|
|
|
|
) -> Result<()> {
|
|
|
|
) -> Result<()> {
|
|
|
|
let line = String::from_utf8_lossy(&line_buffer).to_string();
|
|
|
|
let line = String::from_utf8_lossy(&line_buffer).to_string();
|
|
|
|
|
|
|
|
|
|
|
|
// Highlight.
|
|
|
|
|
|
|
|
let regions = self.highlighter.highlight(line.as_ref());
|
|
|
|
let regions = self.highlighter.highlight(line.as_ref());
|
|
|
|
|
|
|
|
|
|
|
|
// Print.
|
|
|
|
|
|
|
|
if out_of_range {
|
|
|
|
if out_of_range {
|
|
|
|
return Ok(());
|
|
|
|
return Ok(());
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -251,6 +252,10 @@ impl<'a> Printer for InteractivePrinter<'a> {
|
|
|
|
as_terminal_escaped(style, &*text, true_color, colored_output,)
|
|
|
|
as_terminal_escaped(style, &*text, true_color, colored_output,)
|
|
|
|
)?;
|
|
|
|
)?;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if line.bytes().next_back() != Some(b'\n') {
|
|
|
|
|
|
|
|
write!(handle, "\n")?;
|
|
|
|
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
for &(style, region) in regions.iter() {
|
|
|
|
for &(style, region) in regions.iter() {
|
|
|
|
let mut ansi_iterator = AnsiCodeIterator::new(region);
|
|
|
|
let mut ansi_iterator = AnsiCodeIterator::new(region);
|
|
|
|