Permalink
Browse files

Make lines jumps only jump to blocks over changes

Instead of every line in a block of modifications which is tedious
  • Loading branch information...
1 parent fe786c1 commit 54eb7862d6b17f4e86a380004f6e682452fbebce @jisaacks committed Mar 10, 2013
Showing with 11 additions and 0 deletions.
  1. +11 −0 git_gutter_change.py
View
@@ -6,10 +6,21 @@
from view_collection import ViewCollection
class GitGutterBaseChangeCommand(sublime_plugin.WindowCommand):
+ def lines_to_blocks(self, lines):
+ blocks = []
+ last_line = -2
+ for line in lines:
+ if line > last_line+1:
+ blocks.append(line)
+ last_line = line
+ return blocks
+
def run(self):
view = self.window.active_view()
inserted, modified, deleted = ViewCollection.diff(view)
+ inserted = self.lines_to_blocks(inserted)
+ modified = self.lines_to_blocks(modified)
all_changes = sorted(inserted + modified + deleted)
row, col = view.rowcol(view.sel()[0].begin())

0 comments on commit 54eb786

Please sign in to comment.