From 243362b77442bb6ea03f3dd2907cdd227ff543d2 Mon Sep 17 00:00:00 2001 From: Mitch Curtis Date: Thu, 6 Mar 2014 16:36:22 +0100 Subject: 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 --- src/plugins/texteditor/basetexteditor.cpp | 9 ++------- 1 file 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) ? -- cgit v1.2.1