fix: Reload commit content when toggling diff display modes

This commit is contained in:
n loewen (aider) 2025-06-08 02:48:53 +01:00
parent 9eaf186cc9
commit f08cae4773
1 changed files with 8 additions and 5 deletions

13
gtm
View File

@ -1118,21 +1118,24 @@ def handle_keyboard_input(key, state: AppState) -> AppState:
elif key == ord('s'):
return toggle_sidebar(state)
elif key == ord('d'):
return replace(state, show_whole_diff=not state.show_whole_diff)
new_state = replace(state, show_whole_diff=not state.show_whole_diff)
return load_commit_content(new_state)
elif key == ord('a'):
# If diff mode is on, pressing 'a' should toggle off additions
# If diff mode is off, pressing 'a' should toggle on additions
if state.show_whole_diff:
return replace(state, show_additions=False, show_whole_diff=False)
new_state = replace(state, show_additions=False, show_whole_diff=False)
else:
return replace(state, show_additions=not state.show_additions)
new_state = replace(state, show_additions=not state.show_additions)
return load_commit_content(new_state)
elif key == ord('x'):
# If diff mode is on, pressing 'x' should toggle off deletions
# If diff mode is off, pressing 'x' should toggle on deletions
if state.show_whole_diff:
return replace(state, show_deletions=False, show_whole_diff=False)
new_state = replace(state, show_deletions=False, show_whole_diff=False)
else:
return replace(state, show_deletions=not state.show_deletions)
new_state = replace(state, show_deletions=not state.show_deletions)
return load_commit_content(new_state)
elif key == ord('w'):
return replace(state, wrap_lines=not state.wrap_lines)
elif key == ord('L'):