mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-31 17:55:01 +00:00
refactor: Improve multi-line input handling with strict closing tag validation
This commit is contained in:
parent
d6ebdff28f
commit
59d0fe00c3
1 changed files with 7 additions and 6 deletions
13
aider/io.py
13
aider/io.py
|
@ -452,17 +452,18 @@ class InputOutput:
|
|||
multiline_tag = None
|
||||
inp += line[1:] + "\n"
|
||||
continue
|
||||
elif line and line[-1] == "}" and multiline_input:
|
||||
elif multiline_input and line.strip():
|
||||
if multiline_tag:
|
||||
# Check if the line ends with tag}
|
||||
if line.endswith(f"{multiline_tag}}}"):
|
||||
inp += line[: -len(multiline_tag) - 1] + "\n"
|
||||
# Check if line is exactly "tag}"
|
||||
if line.strip() == f"{multiline_tag}}}":
|
||||
break
|
||||
else:
|
||||
inp += line + "\n"
|
||||
else:
|
||||
inp += line[:-1] + "\n"
|
||||
# Check if line is exactly "}"
|
||||
elif line.strip() == "}":
|
||||
break
|
||||
else:
|
||||
inp += line + "\n"
|
||||
elif multiline_input:
|
||||
inp += line + "\n"
|
||||
else:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue