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

Method search_forward

Lib/idlelib/searchengine.py:142–162  ·  view source on GitHub ↗
(self, text, prog, line, col, wrap, ok=0)

Source from the content-addressed store, hash-verified

140 return res
141
142 def search_forward(self, text, prog, line, col, wrap, ok=0):
143 wrapped = 0
144 startline = line
145 chars = text.get("%d.0" % line, "%d.0" % (line+1))
146 while chars:
147 m = prog.search(chars[:-1], col)
148 if m:
149 if ok or m.end() > col:
150 return line, m
151 line = line + 1
152 if wrapped and line > startline:
153 break
154 col = 0
155 ok = 1
156 chars = text.get("%d.0" % line, "%d.0" % (line+1))
157 if not chars and wrap:
158 wrapped = 1
159 wrap = 0
160 line = 1
161 chars = text.get("1.0", "2.0")
162 return None
163
164 def search_backward(self, text, prog, line, col, wrap, ok=0):
165 wrapped = 0

Callers 2

search_textMethod · 0.95
replace_allMethod · 0.80

Calls 3

getMethod · 0.45
searchMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected