fix: Ensure last line visibility and prevent drawing beyond screen

This commit is contained in:
n loewen (aider) 2025-06-08 10:27:12 +01:00
parent ab3af5ea60
commit bc10b41059
1 changed files with 7 additions and 3 deletions

10
gtm
View File

@ -554,7 +554,8 @@ def draw_right_pane(stdscr, state):
state.right_scroll_offset = min(state.right_scroll_offset, max_scroll)
# Get visible lines based on the calculated visible height
visible_lines = state.file_lines[state.right_scroll_offset:state.right_scroll_offset + visible_height]
# Add +1 to ensure we can see the last line
visible_lines = state.file_lines[state.right_scroll_offset:state.right_scroll_offset + visible_height + 1]
display_lines = []
deleted_line_map = {}
@ -582,7 +583,7 @@ def draw_right_pane(stdscr, state):
display_row = 0
for line_info in display_lines:
if display_row >= state.height - 2:
if display_row >= state.height - state.status_bar_height:
break
line_type = line_info['type']
@ -879,7 +880,10 @@ def draw_help_popup(stdscr, state):
def draw_status_bar_background(stdscr, layout: StatusBarLayout):
"""Fill the entire status bar area with reverse video background"""
for y in range(layout.start_y, layout.start_y + layout.total_height):
# Make sure we don't try to draw beyond the screen
end_y = min(layout.start_y + layout.total_height, layout.screen_width)
for y in range(layout.start_y, end_y):
try:
# Fill the entire line with spaces in reverse video
# This is more efficient than adding characters one by one