From f47f611e655c6d3f701e3e5397edb9eafb4b6985 Mon Sep 17 00:00:00 2001 From: Paul Gauthier Date: Sun, 4 Jun 2023 14:30:22 -0700 Subject: [PATCH] Handle empty replacement text too --- aider/utils.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/aider/utils.py b/aider/utils.py index a25cf635e..61af34379 100644 --- a/aider/utils.py +++ b/aider/utils.py @@ -99,7 +99,11 @@ def replace_most_similar_chunk(whole, part, replace): if max_similarity < similarity_thresh: return - replace_lines = replace.splitlines() + [""] + if replace: + replace_lines = replace.splitlines() + [""] + else: + replace_lines = [] + modified_whole = ( whole_lines[:most_similar_chunk_start] + replace_lines