(self, text, prog, line, col, wrap, ok=0)
| 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 | |
| 189 | def search_reverse(prog, chars, col): |
no test coverage detected