forked from qt-creator/qt-creator
TextEditor: fix highlighting whole words matches
... at line start and end. Fixes: QTCREATORBUG-31020 Change-Id: I3b26089ef72a34dedfe8846119f672e75bf03215 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -4754,8 +4754,11 @@ void TextEditorWidgetPrivate::highlightSearchResults(const QTextBlock &block, co
|
||||
break;
|
||||
if (m_findFlags & FindWholeWords) {
|
||||
auto posAtWordSeparator = [](const QString &text, int idx) {
|
||||
if (idx < 0 || idx >= text.length())
|
||||
return false;
|
||||
if (idx < 0)
|
||||
return QTC_GUARD(idx == -1);
|
||||
int textLength = text.length();
|
||||
if (idx >= textLength)
|
||||
return QTC_GUARD(idx == textLength);
|
||||
const QChar c = text.at(idx);
|
||||
return !c.isLetterOrNumber() && c != QLatin1Char('_');
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user