def run(self): self.view = self.window.active_view() if not self.view: # View is not ready yet, try again later. sublime.set_timeout(self.run, 1) return self.clear_all() inserted, modified, deleted = ViewCollection.diff(self.view) self.lines_removed(deleted) self.lines_added(inserted) self.lines_modified(modified)
def run(self): self.view = self.window.active_view() if not self.view: # View is not ready yet, try again later. sublime.set_timeout(self.run, 1) return self.clear_all() inserted, modified, deleted = ViewCollection.diff(self.view) self.lines_removed(deleted) self.lines_added(inserted) self.lines_modified(modified)
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) if all_changes: row, col = view.rowcol(view.sel()[0].begin()) current_row = row + 1 line = self.jump(all_changes, current_row) self.window.active_view().run_command("goto_line", {"line": line})
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) if all_changes: row, col = view.rowcol(view.sel()[0].begin()) current_row = row + 1 line = self.jump(all_changes, current_row) self.window.active_view().run_command("goto_line", {"line": line})
def run(self): self.view = self.window.active_view() if not self.view: # View is not ready yet, try again later. sublime.set_timeout(self.run, 1) return self.clear_all() if ViewCollection.untracked(self.view): self.bind_files('untracked') elif ViewCollection.ignored(self.view): self.bind_files('ignored') else: # If the file is untracked there is no need to execute the diff update inserted, modified, deleted = ViewCollection.diff(self.view) self.lines_removed(deleted) self.bind_icons('inserted', inserted) self.bind_icons('changed', modified)
def run(self): self.view = self.window.active_view() if not self.view: # View is not ready yet, try again later. sublime.set_timeout(self.run, 1) return self.clear_all() if ViewCollection.untracked(self.view): self.bind_files('untracked') elif ViewCollection.ignored(self.view): self.bind_files('ignored') else: # If the file is untracked there is no need to execute the diff update inserted, modified, deleted = ViewCollection.diff(self.view) self.lines_removed(deleted) self.bind_icons('inserted', inserted) self.bind_icons('changed', modified)
def run(self): self.view = self.window.active_view() if not self.view: # Sometimes GitGutter tries to run when there is no active window # and it throws an error because self.view is None. # I have only been able to reproduce this in the following scenario: # you clicked on FileA in the sidebar (FileA is not previously open) # not to open it but to preview it. While previewing it you press # ctrl+` to open a console. With the console selected and the # unopened FileA preview showing in the window you click on another # unopened file, FileB to preview that file. There will be no active # window at this time and GitGutter will throw an error. So we can # just skip running this time because immediately after selecting # FileB, focus will shift from the console to its preview. This will # cause GitGutter to run again on the FileB preview. # Wow that was a really long explanation. return self.clear_all() inserted, modified, deleted = ViewCollection.diff(self.view) self.lines_removed(deleted) self.lines_added(inserted) self.lines_modified(modified)
def run(self): self.view = self.window.active_view() if not self.view: # Sometimes GitGutter tries to run when there is no active window # and it throws an error because self.view is None. # I have only been able to reproduce this in the following scenario: # you clicked on FileA in the sidebar (FileA is not previously open) # not to open it but to preview it. While previewing it you press # ctrl+` to open a console. With the console selected and the # unopened FileA preview showing in the window you click on another # unopened file, FileB to preview that file. There will be no active # window at this time and GitGutter will throw an error. So we can # just skip running this time because immediately after selecting # FileB, focus will shift from the console to its preview. This will # cause GitGutter to run again on the FileB preview. # Wow that was a really long explanation. return self.clear_all() inserted, modified, deleted = ViewCollection.diff(self.view) self.lines_removed(deleted) self.lines_added(inserted) self.lines_modified(modified)