Fix Enter and backspace for textbox. Used as an aux function for the textpad.edit method
(self, ch)
| 342 | self.resize() |
| 343 | |
| 344 | def _search_validator(self, ch): |
| 345 | """Fix Enter and backspace for textbox. |
| 346 | |
| 347 | Used as an aux function for the textpad.edit method |
| 348 | |
| 349 | """ |
| 350 | if ch == curses.ascii.NL: # Enter |
| 351 | return curses.ascii.BEL |
| 352 | elif ch == 127: # Backspace |
| 353 | self.search_str = self.textpad.gather().strip().lower()[:-1] |
| 354 | return 8 |
| 355 | else: |
| 356 | if 0 < ch < 256: |
| 357 | c = chr(ch) |
| 358 | if c in string.printable: |
| 359 | res = self.textpad.gather().strip().lower() |
| 360 | self.search_str = res + chr(ch) |
| 361 | self.search_results(look_in_cur=True) |
| 362 | self.display() |
| 363 | return ch |
| 364 | |
| 365 | def search(self): |
| 366 | """Open search window, get input and set the search string.""" |
nothing calls this directly
no test coverage detected