Permalink
Browse files

Better undo fix

The original undo fix was to make the command not a view command (because that effected the undo) but that made it too slow and needed to be called in a timeout delay which cause a flicker that bugged me. This uses a window command which doesn't need the delay that causes a flicker and doesn't break undo
fixes #26
  • Loading branch information...
1 parent 98dd39a commit 729cfde1dc44cc271b89b9753969710fd964d1a4 @jisaacks committed Dec 22, 2012
Showing with 4 additions and 18 deletions.
  1. +2 −8 git_gutter.py
  2. +1 −8 git_gutter_events.py
  3. +1 −2 git_gutter_handler.py
View
@@ -3,16 +3,10 @@
from view_collection import ViewCollection
-class GitGutterCommand(sublime_plugin.TextCommand):
- def run(self, edit):
- GitGutter(self.view).run()
-
-
-class GitGutter(object):
- def __init__(self, view):
- self.view = view
+class GitGutterCommand(sublime_plugin.WindowCommand):
def run(self):
+ self.view = self.window.active_view()
self.clear_all()
inserted, modified, deleted = ViewCollection.diff(self.view)
self.lines_removed(deleted)
View
@@ -4,16 +4,9 @@
class GitGutterEvents(sublime_plugin.EventListener):
- def on_load(self, view):
- ViewCollection.add(view)
-
def on_modified(self, view):
if view.settings().get('git_gutter_live_mode', True):
- # Sublime Text is very strict on the amount of time plugin
- # uses in performance-critical events. Sometimes invoking plugin
- # from this event causes Sublime warning to appear, so we need to
- # schedule its run for future.
- sublime.set_timeout(lambda: ViewCollection.add(view), 1)
+ ViewCollection.add(view)
def on_clone(self, view):
ViewCollection.add(view)
View
@@ -4,7 +4,6 @@
import subprocess
import re
from view_collection import ViewCollection
-from git_gutter import GitGutter
class GitGutterHandler:
@@ -23,7 +22,7 @@ def on_disk(self):
def reset(self):
if self.on_disk() and self.git_path:
- GitGutter(self.view).run()
+ self.view.window().run_command('git_gutter')
def get_git_path(self):
return self.git_path

0 comments on commit 729cfde

Please sign in to comment.