Skip to content

Commit 5a68067

Browse files
feat: Disable history for confirm_ask prompts to avoid clutter
1 parent 2c4a126 commit 5a68067

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

aider/io.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,31 @@ def wrapper(self, *args, **kwargs):
7171
return wrapper
7272

7373

74+
def without_input_history(func):
75+
"""Decorator to temporarily disable history saving for the prompt session buffer."""
76+
77+
@functools.wraps(func)
78+
def wrapper(self, *args, **kwargs):
79+
orig_buf_append = None
80+
try:
81+
orig_buf_append = self.prompt_session.default_buffer.append_to_history
82+
self.prompt_session.default_buffer.append_to_history = (
83+
lambda: None
84+
) # Replace with no-op
85+
except AttributeError:
86+
pass
87+
88+
try:
89+
return func(self, *args, **kwargs)
90+
except Exception:
91+
raise
92+
finally:
93+
if orig_buf_append:
94+
self.prompt_session.default_buffer.append_to_history = orig_buf_append
95+
96+
return wrapper
97+
98+
7499
class CommandCompletionException(Exception):
75100
"""Raised when a command should use the normal autocompleter instead of
76101
command-specific completion."""
@@ -793,6 +818,7 @@ def offer_url(self, url, prompt="Open URL for more info?", allow_never=True):
793818
return False
794819

795820
@restore_multiline
821+
@without_input_history
796822
def confirm_ask(
797823
self,
798824
question,

0 commit comments

Comments
 (0)