forked from qt-creator/qt-creator
Fixed index out of range.
Reviewed-by: Thorbjørn Lindeijer <thorbjorn.lindeijer@nokia.com>
This commit is contained in:
@@ -131,6 +131,11 @@ int BackwardsScanner::previousBlockState(const QTextBlock &block) const
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int BackwardsScanner::size() const
|
||||||
|
{
|
||||||
|
return _tokens.size();
|
||||||
|
}
|
||||||
|
|
||||||
int BackwardsScanner::startOfMatchingBrace(int index) const
|
int BackwardsScanner::startOfMatchingBrace(int index) const
|
||||||
{
|
{
|
||||||
const BackwardsScanner &tk = *this;
|
const BackwardsScanner &tk = *this;
|
||||||
|
|||||||
@@ -69,6 +69,8 @@ public:
|
|||||||
|
|
||||||
int previousBlockState(const QTextBlock &block) const;
|
int previousBlockState(const QTextBlock &block) const;
|
||||||
|
|
||||||
|
int size() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const SimpleToken &fetchToken(int i);
|
const SimpleToken &fetchToken(int i);
|
||||||
|
|
||||||
|
|||||||
@@ -1579,7 +1579,8 @@ void CPPEditor::indentBlock(QTextDocument *doc, QTextBlock block, QChar typedCha
|
|||||||
tabSettings().indentLine(block, indent);
|
tabSettings().indentLine(block, indent);
|
||||||
return;
|
return;
|
||||||
} else if ((firstToken.is(T_PUBLIC) || firstToken.is(T_PROTECTED) || firstToken.is(T_PRIVATE) ||
|
} 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);
|
const int startOfBlock = tk.startOfBlock(0);
|
||||||
if (startOfBlock != 0) {
|
if (startOfBlock != 0) {
|
||||||
const int indent = tk.indentation(startOfBlock);
|
const int indent = tk.indentation(startOfBlock);
|
||||||
|
|||||||
Reference in New Issue
Block a user