From 794f6d07161c0dd986f61e960892530f1b3e7add Mon Sep 17 00:00:00 2001 From: "n loewen (aider)" Date: Sat, 7 Jun 2025 20:01:01 +0100 Subject: [PATCH] refactor: Improve handling of deleted lines in diff display --- gtm | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/gtm b/gtm index 7766389..2416ce0 100755 --- a/gtm +++ b/gtm @@ -190,14 +190,19 @@ def main(stdscr, filename, show_additions=False, show_deletions=False): # If showing deletions, check if there are deleted lines at this position if show_deletions: + # Collect all deleted lines at this position + deleted_at_position = [] for del_line_num, del_line_content in deleted_lines: if del_line_num == line_num: - # Add the deleted line after the current line - display_lines.append({ - 'type': 'deleted', - 'content': del_line_content, - 'line_num': line_num - }) + deleted_at_position.append(del_line_content) + + # Add all deleted lines together after the current line + for del_content in deleted_at_position: + display_lines.append({ + 'type': 'deleted', + 'content': del_content, + 'line_num': line_num + }) # Now display all lines display_row = 0