Permalink
Browse files

Add a Focus Change mode to allow to disable evaluation when changing …

…the active view
  • Loading branch information...
1 parent b435bff commit 8b3d868f6d248ec7ce9d0dce681ed9fb0a0052ff @codeheroics codeheroics committed Mar 14, 2013
Showing with 11 additions and 3 deletions.
  1. +5 −1 GitGutter.sublime-settings
  2. +6 −2 git_gutter_events.py
@@ -3,8 +3,12 @@
"git_binary": "",
// Live mode evaluates changes every time file is modified,
- // Set false to only evaluate when file is saved.
+ // Set false to disable evaluation after each input
"live_mode": true,
+
+ // Focus Change mode evaluates changes every time a view gets the focus
+ // Set false to disable evaluation when changing views
+ "focus_change_mode": true,
// When set to true GitGutter runs asynchronously in a seperate thread
// This may cause a small delay between a modification and the icon change
View
@@ -26,7 +26,7 @@ def on_post_save(self, view):
ViewCollection.add(view)
def on_activated(self, view):
- if not self.non_blocking:
+ if not self.non_blocking and self.focus_change_mode:
ViewCollection.add(view)
@@ -47,7 +47,7 @@ def on_post_save_async(self, view):
ViewCollection.add(view)
def on_activated_async(self, view):
- if self.non_blocking:
+ if self.non_blocking and self.focus_change_mode:
ViewCollection.add(view)
# Settings
@@ -59,6 +59,10 @@ def load_settings(self):
if self.live_mode is None:
self.live_mode = True
+ self.focus_change_mode = self.settings.get('focus_change_mode')
+ if self.focus_change_mode is None:
+ self.focus_change_mode = True
+
self.non_blocking = self.settings.get('non_blocking')
if self.non_blocking is None or int(sublime.version()) < 3014:
self.non_blocking = False

0 comments on commit 8b3d868

Please sign in to comment.