refactor: Extract prompt prefix logic in InputOutput class

This commit is contained in:
Paul Gauthier 2025-03-21 20:40:29 -07:00 committed by Paul Gauthier (aider)
parent 033c149737
commit 64b8fc80e8

View file

@ -504,11 +504,16 @@ class InputOutput:
get_rel_fname(fname, root) for fname in (abs_read_only_fnames or [])
]
show = self.format_files_for_input(rel_fnames, rel_read_only_fnames)
prompt_prefix = ""
if edit_format:
show += edit_format
prompt_prefix += edit_format
if self.multiline_mode:
show += (" " if edit_format else "") + "multi"
show += "> "
prompt_prefix += (" " if edit_format else "") + "multi"
prompt_prefix += "> "
show += prompt_prefix
self.prompt_prefix = prompt_prefix
inp = ""
multiline_input = False
@ -578,7 +583,7 @@ class InputOutput:
while True:
if multiline_input:
show = "> "
show = self.prompt_prefix
try:
if self.prompt_session:
@ -594,7 +599,7 @@ class InputOutput:
self.clipboard_watcher.start()
def get_continuation(width, line_number, is_soft_wrap):
return "> "
return self.prompt_prefix
line = self.prompt_session.prompt(
show,