From 93496af02b97167c412c9049be6a19b6b4900541 Mon Sep 17 00:00:00 2001 From: brapru Date: Sun, 13 Feb 2022 11:56:31 -0500 Subject: [PATCH] LibVT: Fix triple click behavior When triple clicking a line in the terminal the selection will span the whole line. However, after dragging down to lines above/below the selection will stop at the cursor. Instead, the expected functionality of triple clicking and dragging is to select the whole line and any whole lines dragged to after the triple click. Previously, the triple line counter would get reset as soon as the whole line was selected. This patch resets the m_triple_click_timer in the mouse up event, so that the triple click selecting functionality is maintained during the entire click event and terminated when the event is over. --- Userland/Libraries/LibVT/TerminalWidget.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Userland/Libraries/LibVT/TerminalWidget.cpp b/Userland/Libraries/LibVT/TerminalWidget.cpp index 8bfe60fed4..c47cdc004d 100644 --- a/Userland/Libraries/LibVT/TerminalWidget.cpp +++ b/Userland/Libraries/LibVT/TerminalWidget.cpp @@ -776,6 +776,10 @@ void TerminalWidget::mouseup_event(GUI::MouseEvent& event) m_active_href_id = {}; update(); } + + if (m_triple_click_timer.is_valid()) + m_triple_click_timer.reset(); + set_auto_scroll_direction(AutoScrollDirection::None); } } @@ -809,7 +813,6 @@ void TerminalWidget::mousedown_event(GUI::MouseEvent& event) else if (m_rectangle_selection) m_rectangle_selection = false; - m_triple_click_timer.reset(); update_copy_action(); update(); }