summaryrefslogtreecommitdiffstats
path: root/src/delta.rs
diff options
context:
space:
mode:
authorDan Davison <dandavison7@gmail.com>2020-12-29 06:53:43 -0500
committerGitHub <noreply@github.com>2020-12-29 06:53:43 -0500
commitb8b968071698d74c0f644a4a169b73b0cf1445f1 (patch)
treef944017bcbb7cd27003bbdb7e2298af657c5fa54 /src/delta.rs
parent703ce650756db5b378c67eb080e979e30ae1477e (diff)
Hyperlink file and line number (#479)
Hyperlinks seem to be rendering with just the file path underlined, at least in iTerm2, whereas the intention was for the file and line-number to be rendered jointly (both underlined) as a hyperlink. The link structure is ␛]8;;file-line-column:///Users/dan/src/delta/src/hunk_header.rs:114␛\␛[38;5;1msrc/hunk_header.rs␛[0m:␛[38;5;4m114␛[0m␛]8;;␛\:
Diffstat (limited to 'src/delta.rs')
-rw-r--r--src/delta.rs10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/delta.rs b/src/delta.rs
index f72302e4..81871068 100644
--- a/src/delta.rs
+++ b/src/delta.rs
@@ -350,7 +350,7 @@ impl<'a> StateMachine<'a> {
self.painter.set_highlighter();
self.painter.emit()?;
- let (raw_code_fragment, line_numbers) = parse::parse_hunk_header(&self.line);
+ let (code_fragment, line_numbers) = parse::parse_hunk_header(&self.line);
if self.config.line_numbers {
self.painter
.line_numbers_data
@@ -367,8 +367,14 @@ impl<'a> StateMachine<'a> {
} else if self.config.hunk_header_style.is_omitted {
writeln!(self.painter.writer)?;
} else {
+ // Add a blank line below the hunk-header-line for readability, unless
+ // color_only mode is active.
+ if !self.config.color_only {
+ writeln!(self.painter.writer)?;
+ }
+
hunk_header::write_hunk_header(
- &raw_code_fragment,
+ &code_fragment,
&line_numbers,
&mut self.painter,
&self.line,