Skip to content

Commit 14ac20a

Browse files
committed
Issue #19: Replace the guard in on_modified() to is_applicable() and replace on_modified() to async version for performance.
1 parent 68f21e2 commit 14ac20a

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

git-blame.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -328,13 +328,17 @@ def run(self, edit):
328328

329329
class BlameEraseAllListener(sublime_plugin.ViewEventListener):
330330

331-
def on_modified(self):
331+
@classmethod
332+
def is_applicable(cls, settings):
333+
'''Checks if the blame_erase_all command is applicable.
334+
'''
335+
return settings.get(SETTING_PHANTOM_ALL_DISPLAYED, False)
336+
337+
def on_modified_async(self):
332338
'''Automatically erases the blame results to prevent mismatches.
333339
'''
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)
340+
self.view.run_command('blame_erase_all')
341+
self.view.settings().erase(SETTING_PHANTOM_ALL_DISPLAYED)
338342

339343

340344
class InsertCommitDescriptionCommand(sublime_plugin.TextCommand):

0 commit comments

Comments
 (0)