From b5f812d11d31de6095c1104ffe72a2df71799914 Mon Sep 17 00:00:00 2001 From: brapru Date: Thu, 26 Aug 2021 22:37:45 -0400 Subject: [PATCH] LibVT: Add movemouse support for triple click When moving the mouse after a triple click, the selected buffer does not maintain the whole line selection. This patch will allow triple click highlighting to hold the whole line selection. --- Userland/Libraries/LibVT/TerminalWidget.cpp | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/Userland/Libraries/LibVT/TerminalWidget.cpp b/Userland/Libraries/LibVT/TerminalWidget.cpp index db0c57770a..3d75402c20 100644 --- a/Userland/Libraries/LibVT/TerminalWidget.cpp +++ b/Userland/Libraries/LibVT/TerminalWidget.cpp @@ -869,8 +869,21 @@ void TerminalWidget::mousemove_event(GUI::MouseEvent& event) m_auto_scroll_direction = AutoScrollDirection::None; VT::Position old_selection_end = m_selection.end(); - m_selection.set_end(position); - if (old_selection_end != m_selection.end()) { + VT::Position old_selection_start = m_selection.start(); + + if (m_triple_click_timer.is_valid()) { + int start_column = 0; + int end_column = m_terminal.columns() - 1; + + if (position.row() < m_left_mousedown_position_buffer.row()) + m_selection.set({ position.row(), start_column }, { m_left_mousedown_position_buffer.row(), end_column }); + else + m_selection.set({ m_left_mousedown_position_buffer.row(), start_column }, { position.row(), end_column }); + } else { + m_selection.set_end(position); + } + + if (old_selection_end != m_selection.end() || old_selection_start != m_selection.start()) { update_copy_action(); update(); }