mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-24 06:15:00 +00:00
Tighter regex to find the filename
This commit is contained in:
parent
943a789874
commit
1b72656618
1 changed files with 2 additions and 2 deletions
4
coder.py
4
coder.py
|
@ -303,14 +303,14 @@ class Coder:
|
|||
self.console.print(md)
|
||||
|
||||
pattern = re.compile(
|
||||
r"(\S+)\s+(```\s*)?<<<<<<< ORIGINAL\n(.*?\n?)=======\n(.*?\n?)>>>>>>> UPDATED",
|
||||
r"(^```\S*\s*)?^((?:[a-zA-Z]:\\|/)?(?:[\w\s.-]+[\\/])*\w+\.\w+)\s+(^```\S*\s*)?^<<<<<<< ORIGINAL\n(.*?\n?)^=======\n(.*?\n?)*^>>>>>>> UPDATED", # noqa: E501
|
||||
re.MULTILINE | re.DOTALL,
|
||||
)
|
||||
|
||||
def update_files(self, content, inp):
|
||||
edited = set()
|
||||
for match in self.pattern.finditer(content):
|
||||
path, _, original, updated = match.groups()
|
||||
_, path, _, original, updated = match.groups()
|
||||
|
||||
edited.add(path)
|
||||
if self.do_replace(path, original, updated):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue