From 44198e8b3b3724c890660c0697106361327c7224 Mon Sep 17 00:00:00 2001 From: Paul Gauthier Date: Tue, 20 Jun 2023 06:57:19 -0700 Subject: [PATCH] Fix for issue #24, provided by @wwestenbrink --- aider/utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/aider/utils.py b/aider/utils.py index 3da9f3584..c1053bec1 100644 --- a/aider/utils.py +++ b/aider/utils.py @@ -67,7 +67,7 @@ def replace_part_with_missing_leading_whitespace(whole, part, replace): # If all lines in the part start with whitespace, then honor it. # But GPT often outdents the part and replace blocks completely, # thereby discarding the actual leading whitespace in the file. - if all(pline[0].isspace() for pline in part_lines): + if all((len(pline) > 0 and pline[0].isspace()) for pline in part_lines): return for i in range(len(whole_lines) - len(part_lines) + 1):