MCPcopy Index your code
hub / github.com/RustPython/RustPython / isearch_next

Method isearch_next

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

Source from the content-addressed store, hash-verified

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

Callers 3

doMethod · 0.80
doMethod · 0.80
doMethod · 0.80

Calls 7

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

Tested by

no test coverage detected