Skip to content

Clear the issue #19 #20

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Nov 20, 2017
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