Permalink
Browse files

Cleanup.

- Removes need for except StopIteration.
  • Loading branch information...
1 parent 6b0e40b commit 26c453445685ea74ce0be9734109e71631253c30 @DavidLGoldberg DavidLGoldberg committed Mar 8, 2013
Showing with 9 additions and 11 deletions.
  1. +9 −11 git_gutter.py
View
@@ -28,17 +28,15 @@ def move_to_change(window, direction):
row, col = view.rowcol(view.sel()[0].begin())
- try:
- if direction == "next":
- line = next(change for change in all_changes
- if change > row + 1)
- else:
- line = next(change for change in reversed(all_changes)
- if change < row + 1)
-
- window.active_view().run_command("goto_line", {"line": line})
- except:
- pass
+ current_row = row + 1
+ if direction == "next":
+ line = next((change for change in all_changes
+ if change > current_row), current_row)
+ else:
+ line = next((change for change in reversed(all_changes)
+ if change < current_row), current_row)
+
+ window.active_view().run_command("goto_line", {"line": line})
class GitGutterNextChangeCommand(sublime_plugin.WindowCommand):

0 comments on commit 26c4534

Please sign in to comment.