Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 27 additions & 23 deletions aider/io.py
Original file line number Diff line number Diff line change
Expand Up @@ -559,6 +559,16 @@ def _validate_color_settings(self):
)
setattr(self, attr_name, None) # Reset invalid color to None

def _get_confirmation_key_bindings(self):
"""Get key bindings for confirmation prompts (simpler than main input)."""
kb = KeyBindings()

@kb.add("enter")
def _(event):
event.current_buffer.validate_and_handle()

return kb

def _get_style(self):
style_dict = {}
if not self.pretty:
Expand Down Expand Up @@ -1126,29 +1136,23 @@ async def _confirm_ask(
while True:
try:
if self.prompt_session:
if (
not self.input_task
or self.input_task.done()
or self.input_task.cancelled()
):
coder = self.coder() if self.coder else None

if coder:
self.input_task = asyncio.create_task(coder.get_input())
await asyncio.sleep(0)

if (
self.input_task
and not self.input_task.done()
and not self.input_task.cancelled()
):
self.prompt_session.message = question
self.prompt_session.app.invalidate()
else:
await asyncio.sleep(0)

res = await self.input_task
await asyncio.sleep(0)
# For confirmation prompts, use a temporary session without history
temp_session_kwargs = {
"input": self.input,
"output": self.output,
"editing_mode": self.editingmode,
}
if self.editingmode == EditingMode.VI:
temp_session_kwargs["cursor"] = ModalCursorShapeConfig()

# Create a temporary prompt session without history
temp_prompt_session = PromptSession(**temp_session_kwargs)

res = await temp_prompt_session.prompt_async(
question,
style=self._get_style(),
key_bindings=self._get_confirmation_key_bindings(),
)
else:
res = await asyncio.get_event_loop().run_in_executor(
None, input, question
Expand Down