forked from qt-creator/qt-creator
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>
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user