forked from qt-creator/qt-creator
Help/litehtml: Correcly escape search expression
Searching for anything with e.g. '(' in it would fail. Change-Id: Ifdba978855a425f50b2fc80d01841a7d4c33dd11 Reviewed-by: Cristian Adam <cristian.adam@qt.io> Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
@@ -1165,7 +1165,7 @@ void DocumentContainer::findText(const QString &text,
|
|||||||
return Selection::Element{e.element, e.index, fm.size(0, text.left(e.index)).width()};
|
return Selection::Element{e.element, e.index, fm.size(0, text.left(e.index)).width()};
|
||||||
};
|
};
|
||||||
|
|
||||||
QString term = text;
|
QString term = QRegularExpression::escape(text);
|
||||||
if (flags & QTextDocument::FindWholeWords)
|
if (flags & QTextDocument::FindWholeWords)
|
||||||
term = QString("\\b%1\\b").arg(term);
|
term = QString("\\b%1\\b").arg(term);
|
||||||
const QRegularExpression::PatternOptions patternOptions
|
const QRegularExpression::PatternOptions patternOptions
|
||||||
|
Reference in New Issue
Block a user