Skip to content

Commit 68f21e2

Browse files
committed
Issue #19: Stop BlameEraseAll command to be invoked on every edit.
1 parent 885a5a7 commit 68f21e2

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

git-blame.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
from subprocess import check_output as shell
88

99
PHANTOM_KEY_ALL = 'git-blame-all'
10+
SETTING_PHANTOM_ALL_DISPLAYED = 'git-blame-all-displayed'
1011

1112
stylesheet_one = '''
1213
<style>
@@ -240,6 +241,7 @@ def run(self, edit):
240241
phantoms.append(phantom)
241242

242243
self.phantom_set.update(phantoms)
244+
self.view.settings().set(SETTING_PHANTOM_ALL_DISPLAYED, True)
243245

244246
def get_blame_lines(self, path):
245247
'''Run `git blame` and get the output lines.
@@ -329,7 +331,10 @@ class BlameEraseAllListener(sublime_plugin.ViewEventListener):
329331
def on_modified(self):
330332
'''Automatically erases the blame results to prevent mismatches.
331333
'''
332-
self.view.run_command('blame_erase_all')
334+
settings = self.view.settings()
335+
if settings.get(SETTING_PHANTOM_ALL_DISPLAYED, False):
336+
self.view.run_command('blame_erase_all')
337+
settings.erase(SETTING_PHANTOM_ALL_DISPLAYED)
333338

334339

335340
class InsertCommitDescriptionCommand(sublime_plugin.TextCommand):

0 commit comments

Comments
 (0)