fix: Modify mouse selection to allow text selection without interruption

This commit is contained in:
n loewen (aider) 2025-06-07 22:36:58 +01:00
parent 4fb2c353df
commit b35b07e003
1 changed files with 4 additions and 4 deletions

View File

@ -438,8 +438,9 @@ def handle_mouse_input(stdscr, state):
state.last_bstate = bstate
state.mouse_x, state.mouse_y = mx, my
# If selection is in progress, any mouse event should clear it
if state.is_selecting:
# If selection is in progress, only end it on mouse button release or press
if state.is_selecting and (bstate & curses.BUTTON1_RELEASED or bstate & curses.BUTTON1_PRESSED):
# End the current selection
state.is_selecting = False
state.selection_start_coord = None
state.selection_end_coord = None
@ -447,9 +448,8 @@ def handle_mouse_input(stdscr, state):
# Redraw immediately to clear selection highlight
draw_ui(stdscr, state)
# If this was a new click, continue processing it
# If this was a new click, start a new selection
if bstate & curses.BUTTON1_PRESSED:
# Reset selection state and start a new selection
state.is_selecting = True
state.selection_start_coord = (mx, my)
state.selection_end_coord = (mx, my)