Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion git-blame.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
from subprocess import check_output as shell

PHANTOM_KEY_ALL = 'git-blame-all'
SETTING_PHANTOM_ALL_DISPLAYED = 'git-blame-all-displayed'

stylesheet_one = '''
<style>
Expand Down Expand Up @@ -240,6 +241,7 @@ def run(self, edit):
phantoms.append(phantom)

self.phantom_set.update(phantoms)
self.view.settings().set(SETTING_PHANTOM_ALL_DISPLAYED, True)

def get_blame_lines(self, path):
'''Run `git blame` and get the output lines.
Expand Down Expand Up @@ -326,10 +328,17 @@ def run(self, edit):

class BlameEraseAllListener(sublime_plugin.ViewEventListener):

def on_modified(self):
@classmethod
def is_applicable(cls, settings):
'''Checks if the blame_erase_all command is applicable.
'''
return settings.get(SETTING_PHANTOM_ALL_DISPLAYED, False)

def on_modified_async(self):
'''Automatically erases the blame results to prevent mismatches.
'''
self.view.run_command('blame_erase_all')
self.view.settings().erase(SETTING_PHANTOM_ALL_DISPLAYED)


class InsertCommitDescriptionCommand(sublime_plugin.TextCommand):
Expand Down