forked from qt-creator/qt-creator
Highlight single character search results.
The logic behind the old code was that it was pointless to highlight single characters, but it didn't explain why. This is useful for searching for single character variable names, for instance. Change-Id: Ic8cf60190c1a9caa1eb4441921e60f377fbee8d4 Reviewed-by: Eike Ziller <eike.ziller@digia.com>
This commit is contained in:
@@ -4695,14 +4695,9 @@ void BaseTextEditorWidget::clearLink()
|
||||
|
||||
void BaseTextEditorWidget::highlightSearchResults(const QString &txt, Core::FindFlags findFlags)
|
||||
{
|
||||
QString pattern = txt;
|
||||
// highlighting single characters only if you're searching for whole words
|
||||
if (pattern.size() < 2 && !(findFlags & FindWholeWords))
|
||||
pattern.clear();
|
||||
|
||||
if (d->m_searchExpr.pattern() == pattern)
|
||||
if (d->m_searchExpr.pattern() == txt)
|
||||
return;
|
||||
d->m_searchExpr.setPattern(pattern);
|
||||
d->m_searchExpr.setPattern(txt);
|
||||
d->m_searchExpr.setPatternSyntax((findFlags & FindRegularExpression) ?
|
||||
QRegExp::RegExp : QRegExp::FixedString);
|
||||
d->m_searchExpr.setCaseSensitivity((findFlags & FindCaseSensitively) ?
|
||||
|
||||
Reference in New Issue
Block a user