MCPcopy Create free account
hub / github.com/TabViewer/tabview / _search_validator

Method _search_validator

tabview/tabview.py:344–363  ·  view source on GitHub ↗

Fix Enter and backspace for textbox. Used as an aux function for the textpad.edit method

(self, ch)

Source from the content-addressed store, hash-verified

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."""

Callers

nothing calls this directly

Calls 2

search_resultsMethod · 0.95
displayMethod · 0.95

Tested by

no test coverage detected