refactor: Improve handling of deleted lines in diff display

This commit is contained in:
n loewen (aider) 2025-06-07 20:01:01 +01:00
parent d76e5bdc17
commit 794f6d0716
1 changed files with 11 additions and 6 deletions

17
gtm
View File

@ -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