Commit 243362b7 authored by Mitch Curtis's avatar Mitch Curtis

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: default avatarEike Ziller <eike.ziller@digia.com>
parent e804700b
......@@ -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) ?
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment