diff options
author | Marcus Tillmanns <marcus.tillmanns@qt.io> | 2023-05-15 15:55:50 +0200 |
---|---|---|
committer | Marcus Tillmanns <marcus.tillmanns@qt.io> | 2023-05-16 11:50:18 +0000 |
commit | 3416ccd7ec9c441ddcd3aaafd9ad0cb603f05c6e (patch) | |
tree | 753b75421b78ea9d6ede0cf1f57480e93932ee07 /src | |
parent | 22fa5f2d3a600f9932a3abc3c71a72cd45c7f3ee (diff) | |
download | qt-creator-3416ccd7ec9c441ddcd3aaafd9ad0cb603f05c6e.tar.gz |
Terminal: Fix selection
When moving the mouse left or right out of the viewport
the selection would grow into the previous/next line
without the bounding.
Change-Id: Ica38eac3b306338ef24aa4abace66f110edb2aef
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
Diffstat (limited to 'src')
-rw-r--r-- | src/plugins/terminal/terminalwidget.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/plugins/terminal/terminalwidget.cpp b/src/plugins/terminal/terminalwidget.cpp index b3c7421a6a..b63e66b78d 100644 --- a/src/plugins/terminal/terminalwidget.cpp +++ b/src/plugins/terminal/terminalwidget.cpp @@ -1313,8 +1313,11 @@ void TerminalWidget::mouseMoveEvent(QMouseEvent *event) m_scrollTimer.setInterval(scrollInterval); } + QPoint posBoundedToViewport = event->pos(); + posBoundedToViewport.setX(qBound(0, posBoundedToViewport.x(), viewport()->width())); + int start = m_surface->gridToPos(globalToGrid(m_activeMouseSelect.start)); - int newEnd = m_surface->gridToPos(globalToGrid(viewportToGlobal(event->pos()))); + int newEnd = m_surface->gridToPos(globalToGrid(viewportToGlobal(posBoundedToViewport))); if (start > newEnd) { std::swap(start, newEnd); |