fix: Update text selection coordinates when sidebar is hidden
This commit is contained in:
parent
352edde492
commit
022b27474f
36
gtm2.py
36
gtm2.py
|
|
@ -302,12 +302,18 @@ def draw_selection(stdscr, state):
|
||||||
start_x, start_y = state.selection_start_coord
|
start_x, start_y = state.selection_start_coord
|
||||||
end_x, end_y = state.selection_end_coord
|
end_x, end_y = state.selection_end_coord
|
||||||
|
|
||||||
# Determine pane from where selection started
|
# Determine pane boundaries based on sidebar visibility
|
||||||
pane = 'left' if start_x < state.divider_col else 'right'
|
if state.show_sidebar:
|
||||||
if pane == 'left':
|
# Determine pane from where selection started
|
||||||
pane_x1, pane_x2 = 0, state.divider_col - 1
|
pane = 'left' if start_x < state.divider_col else 'right'
|
||||||
else: # right
|
if pane == 'left':
|
||||||
pane_x1, pane_x2 = state.divider_col + 2, state.width - 1
|
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
|
# Determine drag direction to handle multi-line selection correctly
|
||||||
if start_y < end_y or (start_y == end_y and start_x <= end_x):
|
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
|
start_x, start_y = state.selection_start_coord
|
||||||
end_x, end_y = state.selection_end_coord
|
end_x, end_y = state.selection_end_coord
|
||||||
|
|
||||||
# Determine pane from where selection started
|
# Determine pane boundaries based on sidebar visibility
|
||||||
pane = 'left' if start_x < state.divider_col else 'right'
|
if state.show_sidebar:
|
||||||
if pane == 'left':
|
# Determine pane from where selection started
|
||||||
pane_x1, pane_x2 = 0, state.divider_col - 1
|
pane = 'left' if start_x < state.divider_col else 'right'
|
||||||
else: # right
|
if pane == 'left':
|
||||||
pane_x1, pane_x2 = state.divider_col + 2, state.width - 1
|
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
|
# Determine drag direction to handle multi-line selection correctly
|
||||||
if start_y < end_y or (start_y == end_y and start_x <= end_x):
|
if start_y < end_y or (start_y == end_y and start_x <= end_x):
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue