fix: Ensure last line visibility and prevent drawing beyond screen
This commit is contained in:
parent
ab3af5ea60
commit
bc10b41059
10
gtm
10
gtm
|
|
@ -554,7 +554,8 @@ def draw_right_pane(stdscr, state):
|
||||||
state.right_scroll_offset = min(state.right_scroll_offset, max_scroll)
|
state.right_scroll_offset = min(state.right_scroll_offset, max_scroll)
|
||||||
|
|
||||||
# Get visible lines based on the calculated visible height
|
# 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 = []
|
display_lines = []
|
||||||
deleted_line_map = {}
|
deleted_line_map = {}
|
||||||
|
|
@ -582,7 +583,7 @@ def draw_right_pane(stdscr, state):
|
||||||
|
|
||||||
display_row = 0
|
display_row = 0
|
||||||
for line_info in display_lines:
|
for line_info in display_lines:
|
||||||
if display_row >= state.height - 2:
|
if display_row >= state.height - state.status_bar_height:
|
||||||
break
|
break
|
||||||
|
|
||||||
line_type = line_info['type']
|
line_type = line_info['type']
|
||||||
|
|
@ -879,7 +880,10 @@ def draw_help_popup(stdscr, state):
|
||||||
|
|
||||||
def draw_status_bar_background(stdscr, layout: StatusBarLayout):
|
def draw_status_bar_background(stdscr, layout: StatusBarLayout):
|
||||||
"""Fill the entire status bar area with reverse video background"""
|
"""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:
|
try:
|
||||||
# Fill the entire line with spaces in reverse video
|
# Fill the entire line with spaces in reverse video
|
||||||
# This is more efficient than adding characters one by one
|
# This is more efficient than adding characters one by one
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue