Editor: unselect text on mouse release event

Update the main cursor after calling QPlainTextEdit::mouseReleaseEvent.
Calling that function might change the selection without changing the
position, so it wont emit cursor position changed, and the multi cursor
does not get updated properly.

Task-number: QTCREATORBUG-26493
Change-Id: Ie310ee9a4c66897766af87065ee42fcd01302854
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
David Schulz
2021-11-01 11:02:58 +01:00
parent 1c526c827d
commit 416cd69a5e

View File

@@ -5245,6 +5245,14 @@ void TextEditorWidget::mouseReleaseEvent(QMouseEvent *e)
return;
QPlainTextEdit::mouseReleaseEvent(e);
d->setClipboardSelection();
const QTextCursor plainTextEditCursor = textCursor();
const QTextCursor multiMainCursor = multiTextCursor().mainCursor();
if (multiMainCursor.position() != plainTextEditCursor.position()
|| multiMainCursor.anchor() != plainTextEditCursor.anchor()) {
doSetTextCursor(plainTextEditCursor, true);
}
}
void TextEditorWidget::mouseDoubleClickEvent(QMouseEvent *e)