Skip to content

Commit aeaf337

Browse files
committed
Update to return out of the run function if called from the same line as the last open phantom, instead of wrapping in an if statement
1 parent ded2336 commit aeaf337

File tree

1 file changed

+19
-16
lines changed

1 file changed

+19
-16
lines changed

git-blame.py

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -178,22 +178,25 @@ def run(self, edit):
178178
phantoms = []
179179
self.view.erase_phantoms('git-blame')
180180
#Before adding the phantom, see if the current phantom that is displayed is at the same spot at the selection
181-
if not (self.phantom_set.phantoms and self.view.line(self.view.sel()[0]) == self.view.line(self.phantom_set.phantoms[0].region)):
182-
for region in self.view.sel():
183-
line = self.view.line(region)
184-
(row, col) = self.view.rowcol(region.begin())
185-
full_path = self.view.file_name()
186-
result = self.get_blame(int(row) + 1, full_path)
187-
if not result:
188-
# Unable to get blame
189-
return
190-
191-
sha, user, date, time = self.parse_blame(result)
192-
193-
body = template_one.format(sha=sha, user=user, date=date, time=time, stylesheet=stylesheet_one)
194-
195-
phantom = sublime.Phantom(line, body, sublime.LAYOUT_BLOCK, self.on_phantom_close)
196-
phantoms.append(phantom)
181+
if self.phantom_set.phantoms and self.view.line(self.view.sel()[0]) == self.view.line(self.phantom_set.phantoms[0].region):
182+
self.phantom_set.update(phantoms)
183+
return
184+
185+
for region in self.view.sel():
186+
line = self.view.line(region)
187+
(row, col) = self.view.rowcol(region.begin())
188+
full_path = self.view.file_name()
189+
result = self.get_blame(int(row) + 1, full_path)
190+
if not result:
191+
# Unable to get blame
192+
return
193+
194+
sha, user, date, time = self.parse_blame(result)
195+
196+
body = template_one.format(sha=sha, user=user, date=date, time=time, stylesheet=stylesheet_one)
197+
198+
phantom = sublime.Phantom(line, body, sublime.LAYOUT_BLOCK, self.on_phantom_close)
199+
phantoms.append(phantom)
197200
self.phantom_set.update(phantoms)
198201

199202

0 commit comments

Comments
 (0)