diff options
author | Mitch Curtis <mitch.curtis@digia.com> | 2014-03-06 16:36:22 +0100 |
---|---|---|
committer | Mitch Curtis <mitch.curtis@digia.com> | 2014-03-19 17:30:47 +0100 |
commit | 243362b77442bb6ea03f3dd2907cdd227ff543d2 (patch) | |
tree | f847dda92d7a9ff36599e45b5525d77149443ec7 /src/plugins/texteditor | |
parent | e804700bcfb62535fb3a9f3aad8e88ebb266e195 (diff) | |
download | qt-creator-243362b77442bb6ea03f3dd2907cdd227ff543d2.tar.gz |
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>
Diffstat (limited to 'src/plugins/texteditor')
-rw-r--r-- | src/plugins/texteditor/basetexteditor.cpp | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/src/plugins/texteditor/basetexteditor.cpp b/src/plugins/texteditor/basetexteditor.cpp index 933bedbc0e..345d3d105e 100644 --- a/src/plugins/texteditor/basetexteditor.cpp +++ b/src/plugins/texteditor/basetexteditor.cpp @@ -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) ? |