feat: add input interruption from background threads

This commit is contained in:
Paul Gauthier (aider) 2024-10-25 12:33:07 -07:00
parent 17ce2a3cad
commit 3db3150a7e

View file

@ -345,6 +345,10 @@ class InputOutput:
else:
print()
def interrupt_input(self):
if self.prompt_session and self.prompt_session.app:
self.prompt_session.app.exit()
def get_input(
self,
root,
@ -398,6 +402,7 @@ class InputOutput:
if multiline_input:
show = ". "
try:
try:
if self.prompt_session:
line = self.prompt_session.prompt(
@ -410,6 +415,8 @@ class InputOutput:
)
else:
line = input(show)
except (EOFError, KeyboardInterrupt):
return ""
except UnicodeEncodeError as err:
self.tool_error(str(err))
return ""