From 4db626644813c76b37b3eb1f9eed256e8504b121 Mon Sep 17 00:00:00 2001 From: Matt Smith Date: Fri, 17 Feb 2017 16:21:31 -0800 Subject: [PATCH] Clicking sha now copies --- git-blame.py | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/git-blame.py b/git-blame.py index d5f1f1f..b41fd1d 100644 --- a/git-blame.py +++ b/git-blame.py @@ -17,9 +17,10 @@ text-decoration: none; }} - Git Blame: ({user}) -Last updated: {date} {time} | [{sha}] +Updated: {date} {time} | +[{sha}] | + X  @@ -56,9 +57,20 @@ def parse_blame(self, blame): user, date, time, tz_offset = file_path, user, date, time file_path = None + # Fix an issue where the username has a space + # Im going to need to do something better though if people + # start to have multiple spaces in their names. + if not isinstance(date[0], int): + user = "{0} {1}".format(user, date) + date, time = time, tz_offset + return(sha, user[1:], date, time) def on_phantom_close(self, href): + if href.startswith('copy'): + sha = href.replace('copy-','') + sublime.set_clipboard(sha) + self.view.erase_phantoms('git-blame')