MCPcopy Index your code
hub / github.com/bpython/bpython / add_to_incremental_search

Method add_to_incremental_search

bpython/curtsiesfrontend/repl.py:1201–1217  ·  view source on GitHub ↗

Modify the current search term while in incremental search. The only operations allowed in incremental search mode are adding characters and backspacing.

(self, char=None, backspace=False)

Source from the content-addressed store, hash-verified

1199 self._cursor_offset += max(0, self.cursor_offset - 4)
1200
1201 def add_to_incremental_search(self, char=None, backspace=False):
1202 """Modify the current search term while in incremental search.
1203
1204 The only operations allowed in incremental search mode are
1205 adding characters and backspacing."""
1206 if backspace:
1207 self.incr_search_target = self.incr_search_target[:-1]
1208 elif char is not None:
1209 self.incr_search_target += char
1210 else:
1211 raise ValueError("must provide a char or set backspace to True")
1212 if self.incr_search_mode == SearchMode.REVERSE_INCREMENTAL_SEARCH:
1213 self.incremental_search(reverse=True, include_current=True)
1214 elif self.incr_search_mode == SearchMode.INCREMENTAL_SEARCH:
1215 self.incremental_search(include_current=True)
1216 else:
1217 raise ValueError("add_to_incremental_search not in a special mode")
1218
1219 def update_completion(self, tab=False):
1220 """Update visible docstring and matches and box visibility"""

Callers 2

process_key_eventMethod · 0.95
add_normal_characterMethod · 0.95

Calls 1

incremental_searchMethod · 0.95

Tested by

no test coverage detected