mirror of
https://github.com/Aider-AI/aider.git
synced 2025-06-01 02:05:00 +00:00
feat: add input interruption from background threads
This commit is contained in:
parent
17ce2a3cad
commit
3db3150a7e
1 changed files with 18 additions and 11 deletions
29
aider/io.py
29
aider/io.py
|
@ -345,6 +345,10 @@ class InputOutput:
|
||||||
else:
|
else:
|
||||||
print()
|
print()
|
||||||
|
|
||||||
|
def interrupt_input(self):
|
||||||
|
if self.prompt_session and self.prompt_session.app:
|
||||||
|
self.prompt_session.app.exit()
|
||||||
|
|
||||||
def get_input(
|
def get_input(
|
||||||
self,
|
self,
|
||||||
root,
|
root,
|
||||||
|
@ -399,17 +403,20 @@ class InputOutput:
|
||||||
show = ". "
|
show = ". "
|
||||||
|
|
||||||
try:
|
try:
|
||||||
if self.prompt_session:
|
try:
|
||||||
line = self.prompt_session.prompt(
|
if self.prompt_session:
|
||||||
show,
|
line = self.prompt_session.prompt(
|
||||||
completer=completer_instance,
|
show,
|
||||||
reserve_space_for_menu=4,
|
completer=completer_instance,
|
||||||
complete_style=CompleteStyle.MULTI_COLUMN,
|
reserve_space_for_menu=4,
|
||||||
style=style,
|
complete_style=CompleteStyle.MULTI_COLUMN,
|
||||||
key_bindings=kb,
|
style=style,
|
||||||
)
|
key_bindings=kb,
|
||||||
else:
|
)
|
||||||
line = input(show)
|
else:
|
||||||
|
line = input(show)
|
||||||
|
except (EOFError, KeyboardInterrupt):
|
||||||
|
return ""
|
||||||
except UnicodeEncodeError as err:
|
except UnicodeEncodeError as err:
|
||||||
self.tool_error(str(err))
|
self.tool_error(str(err))
|
||||||
return ""
|
return ""
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue