Editor: fix maybe select lines

Only select the lines if the cursor has no selection. If we have
multiple cursors with a selection the user most probably want to copy or
remove this selection.

Fixes: QTCREATORBUG-26761
Change-Id: Idbf36a878e3d56ea34542b5de390c547bd8bcd6b
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
David Schulz
2022-01-04 10:29:50 +01:00
parent a09d4e2918
commit e478c915ad

View File

@@ -6604,9 +6604,9 @@ void TextEditorWidget::focusOutEvent(QFocusEvent *e)
void TextEditorWidgetPrivate::maybeSelectLine() void TextEditorWidgetPrivate::maybeSelectLine()
{ {
if (q->textCursor().hasSelection() && !q->multiTextCursor().hasMultipleCursors())
return;
MultiTextCursor cursor = m_cursors; MultiTextCursor cursor = m_cursors;
if (cursor.hasSelection())
return;
for (QTextCursor &c : cursor) { for (QTextCursor &c : cursor) {
const QTextBlock &block = m_document->document()->findBlock(c.selectionStart()); const QTextBlock &block = m_document->document()->findBlock(c.selectionStart());
const QTextBlock &end = m_document->document()->findBlock(c.selectionEnd()).next(); const QTextBlock &end = m_document->document()->findBlock(c.selectionEnd()).next();