mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-25 06:44:59 +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)
|
self.console.print(md)
|
||||||
|
|
||||||
pattern = re.compile(
|
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,
|
re.MULTILINE | re.DOTALL,
|
||||||
)
|
)
|
||||||
|
|
||||||
def update_files(self, content, inp):
|
def update_files(self, content, inp):
|
||||||
edited = set()
|
edited = set()
|
||||||
for match in self.pattern.finditer(content):
|
for match in self.pattern.finditer(content):
|
||||||
path, _, original, updated = match.groups()
|
_, path, _, original, updated = match.groups()
|
||||||
|
|
||||||
edited.add(path)
|
edited.add(path)
|
||||||
if self.do_replace(path, original, updated):
|
if self.do_replace(path, original, updated):
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue