summaryrefslogtreecommitdiffstats
path: root/src/features
diff options
context:
space:
mode:
authorDan Davison <dandavison7@gmail.com>2021-08-28 20:21:42 -0400
committerDan Davison <dandavison7@gmail.com>2021-08-28 21:36:57 -0400
commit19eec9bd3e037cd542dfafa40e067098fad917ac (patch)
tree9975e283d01824e500f670ec71863ab4ea79798d /src/features
parent6afd3705d801f03772e5d74b7e137edc169d5e8e (diff)
Handle blame output
Fixes #291, #426
Diffstat (limited to 'src/features')
-rw-r--r--src/features/hyperlinks.rs4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/features/hyperlinks.rs b/src/features/hyperlinks.rs
index 2d3ad3b0..6637734c 100644
--- a/src/features/hyperlinks.rs
+++ b/src/features/hyperlinks.rs
@@ -88,7 +88,7 @@ fn format_osc8_hyperlink(url: &str, text: &str) -> String {
}
lazy_static! {
- static ref COMMIT_LINE_REGEX: Regex = Regex::new("(.* )([0-9a-f]{40})(.*)").unwrap();
+ static ref COMMIT_LINE_REGEX: Regex = Regex::new("(.* )?([0-9a-f]{8,40})(.*)").unwrap();
}
fn format_commit_line_captures_with_osc8_commit_hyperlink(
@@ -100,7 +100,7 @@ fn format_commit_line_captures_with_osc8_commit_hyperlink(
"{prefix}{osc}8;;{url}{st}{commit}{osc}8;;{st}{suffix}",
url = format_github_commit_url(commit, github_repo),
commit = commit,
- prefix = captures.get(1).unwrap().as_str(),
+ prefix = captures.get(1).map(|m| m.as_str()).unwrap_or(""),
suffix = captures.get(3).unwrap().as_str(),
osc = "\x1b]",
st = "\x1b\\"