forked from qt-creator/qt-creator
CppTools: Optimize test for electric char in context
Change-Id: I34a03ec9e781656fd4f24a719fb2c2da2efa4681 Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
This commit is contained in:
committed by
Orgad Shaneh
parent
b35686b968
commit
c5af948623
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user