aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/cpptools/cppqtstyleindenter.cpp
diff options
context:
space:
mode:
authorOrgad Shaneh <orgad.shaneh@audiocodes.com>2014-05-22 23:34:05 +0300
committerOrgad Shaneh <orgads@gmail.com>2014-05-23 14:53:55 +0200
commitc5af948623bd67a4d437fa1374e5f3a67ed3fc25 (patch)
tree2039c8c462bc389f9354f5109d80f2029656a071 /src/plugins/cpptools/cppqtstyleindenter.cpp
parentb35686b96889e33696d0f02c4d35d2fd9803c590 (diff)
CppTools: Optimize test for electric char in context
Change-Id: I34a03ec9e781656fd4f24a719fb2c2da2efa4681 Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
Diffstat (limited to 'src/plugins/cpptools/cppqtstyleindenter.cpp')
-rw-r--r--src/plugins/cpptools/cppqtstyleindenter.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/plugins/cpptools/cppqtstyleindenter.cpp b/src/plugins/cpptools/cppqtstyleindenter.cpp
index eb557a9bde7..1b8ccb66fc0 100644
--- a/src/plugins/cpptools/cppqtstyleindenter.cpp
+++ b/src/plugins/cpptools/cppqtstyleindenter.cpp
@@ -84,9 +84,12 @@ static bool isElectricInLine(const QChar ch, const QString &text)
// lines that start with : might have a constructor initializer list
case '<':
case '>': {
- // Electrical if at line beginning (after space indentation)
- const QString trimmedtext = text.trimmed();
- return !trimmedtext.isEmpty() && trimmedtext.at(0) == ch;
+ // Electric if at line beginning (after space indentation)
+ for (int i = 0, len = text.count(); i < len; ++i) {
+ if (!text.at(i).isSpace())
+ return text.at(i) == ch;
+ }
+ return false;
}
}