forked from qt-creator/qt-creator
Merge remote-tracking branch 'origin/8.0' into 9.0
Conflicts: src/plugins/mcusupport/mcusupportsdk.cpp src/plugins/qmldesigner/components/edit3d/edit3dwidget.cpp src/plugins/qmldesigner/components/materialbrowser/bundleimporter.cpp src/plugins/qmldesigner/components/materialbrowser/materialbrowserview.cpp Change-Id: I9317da0fc1243b9ce6d87f577aa843c51f132ad7
This commit is contained in:
@@ -5706,8 +5706,8 @@ void TextEditorWidget::mouseDoubleClickEvent(QMouseEvent *e)
|
||||
}
|
||||
}
|
||||
|
||||
QTextCursor oldCursor = multiTextCursor().mainCursor();
|
||||
const int oldPosition = oldCursor.position();
|
||||
QTextCursor eventCursor = cursorForPosition(QPoint(e->pos().x(), e->pos().y()));
|
||||
const int eventDocumentPosition = eventCursor.position();
|
||||
|
||||
QPlainTextEdit::mouseDoubleClickEvent(e);
|
||||
|
||||
@@ -5715,19 +5715,19 @@ void TextEditorWidget::mouseDoubleClickEvent(QMouseEvent *e)
|
||||
// event is triggered on a position that is inbetween two whitespaces this event selects the
|
||||
// previous word or nothing if the whitespaces are at the block start. Replace this behavior
|
||||
// with selecting the whitespaces starting from the previous word end to the next word.
|
||||
const QChar character = characterAt(oldPosition);
|
||||
const QChar prevCharacter = characterAt(oldPosition - 1);
|
||||
const QChar character = characterAt(eventDocumentPosition);
|
||||
const QChar prevCharacter = characterAt(eventDocumentPosition - 1);
|
||||
|
||||
if (character.isSpace() && prevCharacter.isSpace()) {
|
||||
if (prevCharacter != QChar::ParagraphSeparator) {
|
||||
oldCursor.movePosition(QTextCursor::PreviousWord);
|
||||
oldCursor.movePosition(QTextCursor::EndOfWord);
|
||||
eventCursor.movePosition(QTextCursor::PreviousWord);
|
||||
eventCursor.movePosition(QTextCursor::EndOfWord);
|
||||
} else if (character == QChar::ParagraphSeparator) {
|
||||
return; // no special handling for empty lines
|
||||
}
|
||||
oldCursor.movePosition(QTextCursor::NextWord, QTextCursor::KeepAnchor);
|
||||
eventCursor.movePosition(QTextCursor::NextWord, QTextCursor::KeepAnchor);
|
||||
MultiTextCursor cursor = multiTextCursor();
|
||||
cursor.replaceMainCursor(oldCursor);
|
||||
cursor.replaceMainCursor(eventCursor);
|
||||
setMultiTextCursor(cursor);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user