From 5f7e1d8675ca9434ec4512a5a7e6915e2644242e Mon Sep 17 00:00:00 2001 From: Paul Gauthier Date: Thu, 3 Aug 2023 16:24:48 -0300 Subject: [PATCH] only add newline for non-empty blocks --- aider/coders/editblock_coder.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/aider/coders/editblock_coder.py b/aider/coders/editblock_coder.py index 4ad2e2641..be6b32337 100644 --- a/aider/coders/editblock_coder.py +++ b/aider/coders/editblock_coder.py @@ -46,7 +46,7 @@ The ORIGINAL block needs to be EXACTLY the same as the lines in {path} with noth def prep(content): - if not content.endswith("\n"): + if content and not content.endswith("\n"): content += "\n" lines = content.splitlines(keepends=True) return content, lines