fix: Update text selection coordinates when sidebar is hidden

This commit is contained in:
n loewen (aider) 2025-06-07 23:51:18 +01:00
parent 352edde492
commit 022b27474f
1 changed files with 24 additions and 12 deletions

12
gtm2.py
View File

@ -302,12 +302,18 @@ def draw_selection(stdscr, state):
start_x, start_y = state.selection_start_coord
end_x, end_y = state.selection_end_coord
# Determine pane boundaries based on sidebar visibility
if state.show_sidebar:
# Determine pane from where selection started
pane = 'left' if start_x < state.divider_col else 'right'
if pane == 'left':
pane_x1, pane_x2 = 0, state.divider_col - 1
else: # right
pane_x1, pane_x2 = state.divider_col + 2, state.width - 1
else:
# When sidebar is hidden, there's only the right pane
pane = 'right'
pane_x1, pane_x2 = 0, state.width - 1
# Determine drag direction to handle multi-line selection correctly
if start_y < end_y or (start_y == end_y and start_x <= end_x):
@ -466,12 +472,18 @@ def copy_selection_to_clipboard(stdscr, state):
start_x, start_y = state.selection_start_coord
end_x, end_y = state.selection_end_coord
# Determine pane boundaries based on sidebar visibility
if state.show_sidebar:
# Determine pane from where selection started
pane = 'left' if start_x < state.divider_col else 'right'
if pane == 'left':
pane_x1, pane_x2 = 0, state.divider_col - 1
else: # right
pane_x1, pane_x2 = state.divider_col + 2, state.width - 1
else:
# When sidebar is hidden, there's only the right pane
pane = 'right'
pane_x1, pane_x2 = 0, state.width - 1
# Determine drag direction to handle multi-line selection correctly
if start_y < end_y or (start_y == end_y and start_x <= end_x):