feat: Add ability to select commits by clicking in the sidebar
This commit is contained in:
parent
87da94851a
commit
a73213a88b
7
gtm2.py
7
gtm2.py
|
|
@ -536,6 +536,13 @@ def handle_mouse_input(stdscr, state):
|
||||||
abs(state.click_position[1] - my) <= 2):
|
abs(state.click_position[1] - my) <= 2):
|
||||||
# This was a click, so switch panes
|
# This was a click, so switch panes
|
||||||
state.focus = "left" if mx < state.divider_col else "right"
|
state.focus = "left" if mx < state.divider_col else "right"
|
||||||
|
|
||||||
|
# If clicking in the left pane on a commit entry, select that commit
|
||||||
|
if mx < state.divider_col and my < len(state.commits) - state.left_scroll_offset:
|
||||||
|
new_commit_idx = my + state.left_scroll_offset
|
||||||
|
if 0 <= new_commit_idx < len(state.commits):
|
||||||
|
state.selected_commit_idx = new_commit_idx
|
||||||
|
state.load_commit_content()
|
||||||
elif state.selection_start_coord and state.selection_end_coord:
|
elif state.selection_start_coord and state.selection_end_coord:
|
||||||
# This was a drag selection, copy the text
|
# This was a drag selection, copy the text
|
||||||
copy_selection_to_clipboard(stdscr, state)
|
copy_selection_to_clipboard(stdscr, state)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue