Skip to content

Commit 6e7b243

Browse files
committed
fixing slowness
1 parent ffd9609 commit 6e7b243

1 file changed

Lines changed: 13 additions & 3 deletions

File tree

src/hyperbase/cli/repl.py

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -134,16 +134,26 @@ def _build_parser_kwargs(parser_cls: type[Parser], settings: dict) -> dict[str,
134134
class FilteredFileHistory(FileHistory):
135135
"""Custom history that filters out blanks and consecutive duplicates.
136136
137-
Set ``paused = True`` to skip persistence around prompts whose input
138-
should not pollute the REPL's command history (e.g. classification
139-
labels typed during ``/classify``).
137+
Set ``paused = True`` to skip both in-memory recall and disk
138+
persistence around prompts whose input should not pollute the REPL's
139+
command history (e.g. classification labels typed during
140+
``/classify``, or the manual-picker prompts in ``/genparse``).
140141
"""
141142

142143
def __init__(self, filename: str) -> None:
143144
super().__init__(filename)
144145
self.last_saved: str | None = None
145146
self.paused: bool = False
146147

148+
def append_string(self, string: str) -> None:
149+
# prompt_toolkit's base History.append_string adds to the
150+
# in-memory list (used by up-arrow / Ctrl-R) *before* calling
151+
# store_string. Skip the whole call while paused so those
152+
# entries don't surface in arrow-key recall either.
153+
if self.paused:
154+
return
155+
super().append_string(string)
156+
147157
def store_string(self, string: str) -> None:
148158
if self.paused:
149159
return

0 commit comments

Comments
 (0)