Permalink
Browse files

Fixed Sublime's undo when GitGutter is active

Seams like the problem was in `run_command` which creates new edit,
thus making every char input separate. In that case every Undo
reverted symbol-by-symbol changes.

This commit separates GitGutter logic from Sublime's TextCommand, so
it can be directly invoked on view

Related issue: #16
  • Loading branch information...
1 parent eb6239b commit 2ea37123858d5d7b7c989e7daa3fa9f67ae2c583 @frantic frantic committed Dec 17, 2012
Showing with 10 additions and 1 deletion.
  1. +8 −0 git_gutter.py
  2. +2 −1 git_gutter_handler.py
View
@@ -5,6 +5,14 @@
class GitGutterCommand(sublime_plugin.TextCommand):
def run(self, edit):
+ GitGutter(self.view).run()
+
+
+class GitGutter(object):
+ def __init__(self, view):
+ self.view = view
+
+ def run(self):
self.clear_all()
inserted, modified, deleted = ViewCollection.diff(self.view)
self.lines_removed(deleted)
View
@@ -4,6 +4,7 @@
import subprocess
import re
from view_collection import ViewCollection
+from git_gutter import GitGutter
class GitGutterHandler:
@@ -22,7 +23,7 @@ def on_disk(self):
def reset(self):
if self.on_disk() and self.git_path:
- self.view.run_command('git_gutter')
+ GitGutter(self.view).run()
def get_git_path(self):
return self.git_path

0 comments on commit 2ea3712

Please sign in to comment.