Editor: do not replace selection in drop editor

Only remove the selected text if the drag source is the editor and we
want to move the selection.

Fixes: QTCREATORBUG-28126
Change-Id: Iaa54d54c432df2da99e30ddb569e06e3ccd0df00
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
David Schulz
2022-09-02 13:31:09 +02:00
parent c58f41face
commit 9456052207

View File

@@ -7665,7 +7665,7 @@ void TextEditorWidget::dropEvent(QDropEvent *e)
MultiTextCursor cursor = multiTextCursor();
cursor.beginEditBlock();
const QTextCursor eventCursor = cursorForPosition(e->pos());
if (e->dropAction() == Qt::MoveAction)
if (e->dropAction() == Qt::MoveAction && e->source() == viewport())
cursor.removeSelectedText();
cursor.setCursors({eventCursor});
setMultiTextCursor(cursor);