From bd7134a6ad9afaab5a12c857032d71aa0ed35e5e Mon Sep 17 00:00:00 2001 From: "Martin T. H. Sandsmark" Date: Sat, 10 Jul 2021 13:03:50 +0200 Subject: [PATCH] When selecting select highlighted case if available (e. g. URLs) --- src/terminalDisplay/TerminalDisplay.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/terminalDisplay/TerminalDisplay.cpp b/src/terminalDisplay/TerminalDisplay.cpp index 4e981d47..e01f243f 100644 --- a/src/terminalDisplay/TerminalDisplay.cpp +++ b/src/terminalDisplay/TerminalDisplay.cpp @@ -1795,6 +1795,12 @@ QPoint TerminalDisplay::findLineEnd(const QPoint &pnt) QPoint TerminalDisplay::findWordStart(const QPoint &pnt) { + // Don't ask me why x and y are switched ¯\_(ツ)_/¯ + QSharedPointer hotspot = _filterChain->hotSpotAt(pnt.y(), pnt.x()); + if (hotspot) { + return QPoint(hotspot->startColumn(), hotspot->startLine()); + } + const int regSize = qMax(_screenWindow->windowLines(), 10); const int firstVisibleLine = _screenWindow->currentLine(); @@ -1867,6 +1873,11 @@ out: QPoint TerminalDisplay::findWordEnd(const QPoint &pnt) { + QSharedPointer hotspot = _filterChain->hotSpotAt(pnt.y(), pnt.x()); + if (hotspot) { + return QPoint(hotspot->endColumn(), hotspot->endLine()); + } + const int regSize = qMax(_screenWindow->windowLines(), 10); const int curLine = _screenWindow->currentLine(); int i = pnt.y();