diff options
Diffstat (limited to 'src/delta.rs')
-rw-r--r-- | src/delta.rs | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/delta.rs b/src/delta.rs index 53e2add8..bb8c1afc 100644 --- a/src/delta.rs +++ b/src/delta.rs @@ -138,7 +138,7 @@ impl<'a> StateMachine<'a> { writeln!( self.painter.writer, "{}", - format::format_raw_line(&self.raw_line, self.config) + format_raw_line(&self.raw_line, self.config) )?; } } @@ -633,6 +633,16 @@ impl<'a> StateMachine<'a> { } } +/// If output is going to a tty, emit hyperlinks if requested. +// Although raw output should basically be emitted unaltered, we do this. +fn format_raw_line<'a>(line: &'a str, config: &Config) -> Cow<'a, str> { + if config.hyperlinks && atty::is(atty::Stream::Stdout) { + features::hyperlinks::format_commit_line_with_osc8_commit_hyperlink(line, config) + } else { + Cow::from(line) + } +} + /// Write `line` with FileMeta styling. fn _write_generic_file_meta_header_line( line: &str, |