diff --git a/aider/coder.py b/aider/coder.py index 7ebbec8c9..fd4789045 100755 --- a/aider/coder.py +++ b/aider/coder.py @@ -500,6 +500,7 @@ class Coder: show_diff = diffs.diff_partial_update( orig_lines, new_lines, + final=True, ).splitlines() output += show_diff else: diff --git a/aider/diffs.py b/aider/diffs.py index 6be64ca98..0bd7f0a95 100644 --- a/aider/diffs.py +++ b/aider/diffs.py @@ -23,7 +23,7 @@ def main(): input() -def diff_partial_update(lines_orig, lines_updated): +def diff_partial_update(lines_orig, lines_updated, final=False): """ Given only the first part of an updated file, show the diff while ignoring the block of "deleted" lines that are past the end of the @@ -40,6 +40,9 @@ def diff_partial_update(lines_orig, lines_updated): lines_orig = lines_orig[:last_non_deleted] + if not final: + lines_updated = lines_updated[:-1] + ["\n"] + diff = difflib.unified_diff(lines_orig, lines_updated) # unified_diff = list(unified_diff)[2:] # dump(repr(list(diff)))