diff --git a/pyrepl/historical_reader.py b/pyrepl/historical_reader.py index 01522ee..7178596 100644 --- a/pyrepl/historical_reader.py +++ b/pyrepl/historical_reader.py @@ -275,7 +275,7 @@ def isearch_next(self): self.select_item(i) self.pos = p return - elif ((forwards and i == len(self.history) - 1) + elif ((forwards and i >= len(self.history) - 1) or (not forwards and i == 0)): self.error("not found") return