mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-30 01:04:59 +00:00
Merge e8f30e0b06
into 3caab85931
This commit is contained in:
commit
e560072158
1 changed files with 26 additions and 0 deletions
26
aider/io.py
26
aider/io.py
|
@ -71,6 +71,31 @@ def restore_multiline(func):
|
||||||
return wrapper
|
return wrapper
|
||||||
|
|
||||||
|
|
||||||
|
def without_input_history(func):
|
||||||
|
"""Decorator to temporarily disable history saving for the prompt session buffer."""
|
||||||
|
|
||||||
|
@functools.wraps(func)
|
||||||
|
def wrapper(self, *args, **kwargs):
|
||||||
|
orig_buf_append = None
|
||||||
|
try:
|
||||||
|
orig_buf_append = self.prompt_session.default_buffer.append_to_history
|
||||||
|
self.prompt_session.default_buffer.append_to_history = (
|
||||||
|
lambda: None
|
||||||
|
) # Replace with no-op
|
||||||
|
except AttributeError:
|
||||||
|
pass
|
||||||
|
|
||||||
|
try:
|
||||||
|
return func(self, *args, **kwargs)
|
||||||
|
except Exception:
|
||||||
|
raise
|
||||||
|
finally:
|
||||||
|
if orig_buf_append:
|
||||||
|
self.prompt_session.default_buffer.append_to_history = orig_buf_append
|
||||||
|
|
||||||
|
return wrapper
|
||||||
|
|
||||||
|
|
||||||
class CommandCompletionException(Exception):
|
class CommandCompletionException(Exception):
|
||||||
"""Raised when a command should use the normal autocompleter instead of
|
"""Raised when a command should use the normal autocompleter instead of
|
||||||
command-specific completion."""
|
command-specific completion."""
|
||||||
|
@ -793,6 +818,7 @@ class InputOutput:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
@restore_multiline
|
@restore_multiline
|
||||||
|
@without_input_history
|
||||||
def confirm_ask(
|
def confirm_ask(
|
||||||
self,
|
self,
|
||||||
question,
|
question,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue