From c9f77e527643b7eeb7459febabbe9d29f249c996 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luis=20Javier=20Merino=20Mor=C3=A1n?= Date: Tue, 23 Mar 2021 17:52:04 +0100 Subject: [PATCH] Restore AutoScrollHandler behavior AutoScrollHandler allows to extend the selection by dragging the mouse outside the display. It does this by generating synthetic mouse move events when the left mouse button is held down and the mouse is moved outside of the display area. This improves the user experience of extending the selection to cover text that is scrolled outside the display area. Unfortunately, this was broken by commit 6667d96ed9d6c95eab4ed13449d4b134005ffb4b, which filters out mouse move events if they don't change the character cell position. So, modify the filtering a bit, allowing mouse movements outside the display area to pass through. --- src/terminalDisplay/TerminalDisplay.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/terminalDisplay/TerminalDisplay.cpp b/src/terminalDisplay/TerminalDisplay.cpp index 6f2742ae..7613cda7 100644 --- a/src/terminalDisplay/TerminalDisplay.cpp +++ b/src/terminalDisplay/TerminalDisplay.cpp @@ -1244,7 +1244,12 @@ void TerminalDisplay::mouseMoveEvent(QMouseEvent* ev) auto [charLine, charColumn] = getCharacterPosition(ev->pos(), !_usesMouseTracking); - if (charLine == _prevCharacterLine && charColumn == _prevCharacterColumn) { + // Ignore mouse movements that don't change the character position, + // but don't ignore the ones generated by AutoScrollHandler (which + // allow to extend the selection by dragging the mouse outside the + // display). + if (charLine == _prevCharacterLine && charColumn == _prevCharacterColumn && + contentsRect().contains(ev->pos())) { return; }