Commit c5af9486 authored by Orgad Shaneh's avatar Orgad Shaneh Committed by Orgad Shaneh

CppTools: Optimize test for electric char in context

Change-Id: I34a03ec9e781656fd4f24a719fb2c2da2efa4681
Reviewed-by: default avatarErik Verbruggen <erik.verbruggen@digia.com>
parent b35686b9
......@@ -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;
}
}
......
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