From b35b07e0030139d08474eec09e99c1ba7e121b1e Mon Sep 17 00:00:00 2001 From: "n loewen (aider)" Date: Sat, 7 Jun 2025 22:36:58 +0100 Subject: [PATCH] fix: Modify mouse selection to allow text selection without interruption --- gtm2.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/gtm2.py b/gtm2.py index e8a00b8..5f93f6d 100755 --- a/gtm2.py +++ b/gtm2.py @@ -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)