forked from qt-creator/qt-creator
Terminal: Fix selection warning
When quickly selection text via double-clicking and moving the mouse to the left it is possible that a selection is created where the start == end. This was incorrectly reported as a warning. Task-number: QTCREATORBUG-30144 Change-Id: I37b22f4ee725e5085ce0090c123ccfd9980b8a59 Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -386,10 +386,13 @@ QString TerminalView::textFromSelection() const
|
|||||||
if (!d->m_selection)
|
if (!d->m_selection)
|
||||||
return {};
|
return {};
|
||||||
|
|
||||||
|
if (d->m_selection->start == d->m_selection->end)
|
||||||
|
return {};
|
||||||
|
|
||||||
CellIterator it = d->m_surface->iteratorAt(d->m_selection->start);
|
CellIterator it = d->m_surface->iteratorAt(d->m_selection->start);
|
||||||
CellIterator end = d->m_surface->iteratorAt(d->m_selection->end);
|
CellIterator end = d->m_surface->iteratorAt(d->m_selection->end);
|
||||||
|
|
||||||
if (it.position() >= end.position()) {
|
if (it.position() > end.position()) {
|
||||||
qCWarning(selectionLog) << "Invalid selection: start >= end";
|
qCWarning(selectionLog) << "Invalid selection: start >= end";
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user