Commit e68753b4 authored by Robert Loehning's avatar Robert Loehning

Fixed index out of range.

Reviewed-by: default avatarThorbjørn Lindeijer <thorbjorn.lindeijer@nokia.com>
parent 674c2635
......@@ -131,6 +131,11 @@ int BackwardsScanner::previousBlockState(const QTextBlock &block) const
return 0;
}
int BackwardsScanner::size() const
{
return _tokens.size();
}
int BackwardsScanner::startOfMatchingBrace(int index) const
{
const BackwardsScanner &tk = *this;
......
......@@ -69,6 +69,8 @@ public:
int previousBlockState(const QTextBlock &block) const;
int size() const;
private:
const SimpleToken &fetchToken(int i);
......
......@@ -1579,7 +1579,8 @@ void CPPEditor::indentBlock(QTextDocument *doc, QTextBlock block, QChar typedCha
tabSettings().indentLine(block, indent);
return;
} else if ((firstToken.is(T_PUBLIC) || firstToken.is(T_PROTECTED) || firstToken.is(T_PRIVATE) ||
firstToken.is(T_Q_SIGNALS) || firstToken.is(T_Q_SLOTS)) && tk[1].is(T_COLON)) {
firstToken.is(T_Q_SIGNALS) || firstToken.is(T_Q_SLOTS)) &&
tk.size() > 1 && tk[1].is(T_COLON)) {
const int startOfBlock = tk.startOfBlock(0);
if (startOfBlock != 0) {
const int indent = tk.indentation(startOfBlock);
......
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