mirror of
https://github.com/Aider-AI/aider.git
synced 2025-06-06 20:54:59 +00:00
go for the full line match first
This commit is contained in:
parent
004c0529c6
commit
e60a332fda
2 changed files with 7 additions and 6 deletions
|
@ -151,13 +151,14 @@ def replace_most_similar_chunk(whole, part, replace):
|
|||
part_lines = part.splitlines(keepends=True)
|
||||
replace_lines = replace.splitlines(keepends=True)
|
||||
|
||||
if part_lines in whole_lines:
|
||||
updated_lines = whole_lines.replace(part_lines, replace_lines)
|
||||
return updated_lines
|
||||
|
||||
res = replace_part_with_missing_leading_whitespace(whole_lines, part_lines, replace_lines)
|
||||
if res:
|
||||
return res
|
||||
|
||||
if part in whole:
|
||||
return whole.replace(part, replace)
|
||||
|
||||
try:
|
||||
res = try_dotdotdots(whole, part, replace)
|
||||
except ValueError:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue