Skip to content

Commit

Permalink
Fix issue in Match previous and next methods
Browse files Browse the repository at this point in the history
  • Loading branch information
Toilal committed Oct 18, 2015
1 parent 1918fca commit 29ea713
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions rebulk/match.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,10 @@ def previous(self, match, predicate=None, index=None):
"""
current = match.start
while current > -1:
current -= 1
previous_matches = self.ending(current)
if previous_matches:
return filter_index(previous_matches, predicate, index)
current -= 1
return filter_index(_BaseMatches._base(), predicate, index)

def next(self, match, predicate=None, index=None):
Expand All @@ -102,12 +102,12 @@ def next(self, match, predicate=None, index=None):
:return:
:rtype:
"""
current = match.start
current = match.start + 1
while current <= self.max_end:
current += 1
next_matches = self.starting(current)
if next_matches:
return filter_index(next_matches, predicate, index)
current += 1
return filter_index(_BaseMatches._base(), predicate, index)

def named(self, name, predicate=None, index=None):
Expand Down

0 comments on commit 29ea713

Please sign in to comment.