fix: Ensure initial commit content is loaded safely when commits exist

This commit is contained in:
n loewen (aider) 2025-06-08 09:22:04 +01:00
parent e36d158cb4
commit a8ac9c1e85
1 changed files with 7 additions and 1 deletions

6
gtm
View File

@ -296,6 +296,10 @@ def load_commit_content(state: AppState) -> AppState:
if not commit_details['message'].strip(): if not commit_details['message'].strip():
commit_details['message'] = short_message commit_details['message'] = short_message
# Ensure we have some commit message to display
if not commit_details['message']:
commit_details['message'] = short_message if short_message else "No commit message"
max_scroll_new = max(0, len(file_lines) - (state.height - state.status_bar_height)) max_scroll_new = max(0, len(file_lines) - (state.height - state.status_bar_height))
right_scroll_offset = state.right_scroll_offset right_scroll_offset = state.right_scroll_offset
if reference_line: if reference_line:
@ -1381,6 +1385,8 @@ def main(stdscr, filename, show_diff, show_add, show_del, mouse, wrap_lines=True
except Exception: except Exception:
pass pass
# Load initial commit content so commit details are available immediately
if state.commits:
state = load_commit_content(state) state = load_commit_content(state)
# Initial draw before the main loop starts # Initial draw before the main loop starts