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

Method search_backward

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

Source from the content-addressed store, hash-verified

162 return None
163
164 def search_backward(self, text, prog, line, col, wrap, ok=0):
165 wrapped = 0
166 startline = line
167 chars = text.get("%d.0" % line, "%d.0" % (line+1))
168 while True:
169 m = search_reverse(prog, chars[:-1], col)
170 if m:
171 if ok or m.start() < col:
172 return line, m
173 line = line - 1
174 if wrapped and line < startline:
175 break
176 ok = 1
177 if line <= 0:
178 if not wrap:
179 break
180 wrapped = 1
181 wrap = 0
182 pos = text.index("end-1c")
183 line, col = map(int, pos.split("."))
184 chars = text.get("%d.0" % line, "%d.0" % (line+1))
185 col = len(chars) - 1
186 return None
187
188
189def search_reverse(prog, chars, col):

Callers 1

search_textMethod · 0.95

Calls 5

search_reverseFunction · 0.85
getMethod · 0.45
startMethod · 0.45
indexMethod · 0.45
splitMethod · 0.45

Tested by

no test coverage detected