MCPcopy Index your code
hub / github.com/python/cpython / isearch_next

Method isearch_next

Lib/_pyrepl/historical_reader.py:380–406  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

378 len_acc += len(line)
379
380 def isearch_next(self) -> None:
381 st = self.isearch_term
382 p = self.pos
383 i = self.historyi
384 s = self.get_unicode()
385 forwards = self.isearch_direction == ISEARCH_DIRECTION_FORWARDS
386 while 1:
387 if forwards:
388 p = s.find(st, p + 1)
389 else:
390 p = s.rfind(st, 0, p + len(st) - 1)
391 if p != -1:
392 self.select_item(i)
393 self.pos = p
394 return
395 elif (forwards and i >= len(self.history) - 1) or (not forwards and i == 0):
396 self.error("not found")
397 return
398 else:
399 if forwards:
400 i += 1
401 s = self.get_item(i)
402 p = -1
403 else:
404 i -= 1
405 s = self.get_item(i)
406 p = len(s)
407
408 def finish(self) -> None:
409 super().finish()

Callers 3

doMethod · 0.80
doMethod · 0.80
doMethod · 0.80

Calls 6

select_itemMethod · 0.95
get_itemMethod · 0.95
get_unicodeMethod · 0.80
findMethod · 0.45
rfindMethod · 0.45
errorMethod · 0.45

Tested by

no test coverage detected