Skip to content

Commit

Permalink
Enhancement: Navigation circulate after the and start over
Browse files Browse the repository at this point in the history
  • Loading branch information
stoivo committed Aug 19, 2017
1 parent 56dc5cc commit 909f031
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions core/commands/navigate.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,12 @@ def forward(self, current_position, file_regions):
for file_region in file_regions:
if file_region.a > current_position:
return file_region.a
return None
# If we are after the last match, pick the first one
return file_regions[0].a if len(file_regions) != 0 else None

def backward(self, current_position, file_regions):
for file_region in reversed(file_regions):
if file_region.b < current_position:
return file_region.a
return None
# If we are after the last match, pick the last one
return file_regions[-1].a if len(file_regions) != 0 else None

0 comments on commit 909f031

Please sign in to comment.