summaryrefslogtreecommitdiff
path: root/src/plugins/cpptools/cppcodeformatter.cpp
diff options
context:
space:
mode:
authorChristian Kamm <christian.d.kamm@nokia.com>2010-09-24 15:08:08 +0200
committerChristian Kamm <christian.d.kamm@nokia.com>2010-09-24 15:08:54 +0200
commitd7bf4f515d36f742d7fd28869c97129beff2a7a5 (patch)
tree7f2ba3edcb29b4281d1c600a2035faaeee57d347 /src/plugins/cpptools/cppcodeformatter.cpp
parentbe563abf68c5c8561d9d6c0b765941b6123fd52e (diff)
downloadqt-creator-d7bf4f515d36f742d7fd28869c97129beff2a7a5.tar.gz
C++ indenter: Fix indentation if template and class appear on one line.
Task-number: QTCREATORBUG-2427
Diffstat (limited to 'src/plugins/cpptools/cppcodeformatter.cpp')
-rw-r--r--src/plugins/cpptools/cppcodeformatter.cpp15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/plugins/cpptools/cppcodeformatter.cpp b/src/plugins/cpptools/cppcodeformatter.cpp
index 87811c01cd..30f589e602 100644
--- a/src/plugins/cpptools/cppcodeformatter.cpp
+++ b/src/plugins/cpptools/cppcodeformatter.cpp
@@ -1040,16 +1040,18 @@ void QtStyleCodeFormatter::onEnter(int newState, int *indentDepth, int *savedInd
switch (newState) {
case namespace_start:
- if (firstToken)
+ if (firstToken) {
*savedIndentDepth = tokenPosition;
- *indentDepth = tokenPosition;
+ *indentDepth = tokenPosition;
+ }
break;
case enum_start:
case class_start:
- if (firstToken)
+ if (firstToken) {
*savedIndentDepth = tokenPosition;
- *indentDepth = tokenPosition;
+ *indentDepth = tokenPosition;
+ }
*paddingDepth = 2*m_indentSize;
break;
@@ -1075,9 +1077,10 @@ void QtStyleCodeFormatter::onEnter(int newState, int *indentDepth, int *savedInd
break;
case declaration_start:
- if (firstToken)
+ if (firstToken) {
*savedIndentDepth = tokenPosition;
- *indentDepth = *savedIndentDepth;
+ *indentDepth = *savedIndentDepth;
+ }
// continuation indent in function bodies only, to not indent
// after the return type in "void\nfoo() {}"
for (int i = 0; state(i).type != topmost_intro; ++i) {