From 8d408e1fc482a8440670cd165db612cba993019c Mon Sep 17 00:00:00 2001 From: Paul Gauthier Date: Fri, 9 Jun 2023 15:05:34 -0700 Subject: [PATCH] Try replace_part_with_missing_leading_whitespace first, so that single line edits get the benefit --- aider/utils.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/aider/utils.py b/aider/utils.py index f69c953bf..b67af7e29 100644 --- a/aider/utils.py +++ b/aider/utils.py @@ -3,7 +3,7 @@ import re from difflib import SequenceMatcher from pathlib import Path -# from aider.dump import dump +from .dump import dump # noqa: F401 def try_dotdotdots(whole, part, replace): @@ -96,13 +96,13 @@ def replace_part_with_missing_leading_whitespace(whole, part, replace): def replace_most_similar_chunk(whole, part, replace): - if part in whole: - return whole.replace(part, replace) - res = replace_part_with_missing_leading_whitespace(whole, part, replace) if res: return res + if part in whole: + return whole.replace(part, replace) + try: res = try_dotdotdots(whole, part, replace) except ValueError: