forked from qt-creator/qt-creator
Editor: fix selecting multiple block selections with mouse
Change-Id: I5b46adbf38358d1396ee7120558648b1375e4047 Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io> Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -50,6 +50,12 @@ void MultiTextCursor::addCursor(const QTextCursor &cursor)
|
|||||||
mergeCursors();
|
mergeCursors();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MultiTextCursor::addCursors(const QList<QTextCursor> &cursors)
|
||||||
|
{
|
||||||
|
m_cursors.append(cursors);
|
||||||
|
mergeCursors();
|
||||||
|
}
|
||||||
|
|
||||||
void MultiTextCursor::setCursors(const QList<QTextCursor> &cursors)
|
void MultiTextCursor::setCursors(const QList<QTextCursor> &cursors)
|
||||||
{
|
{
|
||||||
m_cursors = cursors;
|
m_cursors = cursors;
|
||||||
|
@@ -57,6 +57,7 @@ public:
|
|||||||
/// the \param cursor that is appended by added by \brief addCursor
|
/// the \param cursor that is appended by added by \brief addCursor
|
||||||
/// will be interpreted as the new main cursor
|
/// will be interpreted as the new main cursor
|
||||||
void addCursor(const QTextCursor &cursor);
|
void addCursor(const QTextCursor &cursor);
|
||||||
|
void addCursors(const QList<QTextCursor> &cursors);
|
||||||
/// convenience function that removes the old main cursor and appends
|
/// convenience function that removes the old main cursor and appends
|
||||||
/// \param cursor as the new main cursor
|
/// \param cursor as the new main cursor
|
||||||
void replaceMainCursor(const QTextCursor &cursor);
|
void replaceMainCursor(const QTextCursor &cursor);
|
||||||
|
@@ -5335,7 +5335,7 @@ void TextEditorWidget::mouseMoveEvent(QMouseEvent *e)
|
|||||||
anchorCursor.blockNumber(),
|
anchorCursor.blockNumber(),
|
||||||
anchorColumn};
|
anchorColumn};
|
||||||
|
|
||||||
cursor.setCursors(d->generateCursorsForBlockSelection(blockSelection));
|
cursor.addCursors(d->generateCursorsForBlockSelection(blockSelection));
|
||||||
if (!cursor.isNull())
|
if (!cursor.isNull())
|
||||||
setMultiTextCursor(cursor);
|
setMultiTextCursor(cursor);
|
||||||
} else {
|
} else {
|
||||||
|
Reference in New Issue
Block a user