Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Marco Bubke
flatpak-qt-creator
Commits
27026af2
Commit
27026af2
authored
Jul 28, 2010
by
Christian Kamm
Browse files
C++ indenter: Fix indent of block statements in substatement blocks.
Task-number: QTCREATORBUG-1919
parent
63f7abb0
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/plugins/cpptools/cppcodeformatter.cpp
View file @
27026af2
...
...
@@ -1227,6 +1227,7 @@ void QtStyleCodeFormatter::adjustIndent(const QList<CPlusPlus::Token> &tokens, i
*
indentDepth
+=
m_indentSize
;
}
else
if
(
topState
.
type
!=
defun_open
&&
topState
.
type
!=
block_open
&&
topState
.
type
!=
substatement_open
&&
!
topWasMaybeElse
)
{
*
indentDepth
=
topState
.
savedIndentDepth
;
}
...
...
tests/auto/cplusplus/codeformatter/tst_codeformatter.cpp
View file @
27026af2
...
...
@@ -45,6 +45,7 @@ private Q_SLOTS:
void
singleLineEnum
();
void
functionReturnType
();
void
streamOp
();
void
blockStmtInIf
();
};
struct
Line
{
...
...
@@ -817,6 +818,23 @@ void tst_CodeFormatter::streamOp()
checkIndent
(
data
);
}
void
tst_CodeFormatter
::
blockStmtInIf
()
{
QList
<
Line
>
data
;
data
<<
Line
(
"void foo () {"
)
<<
Line
(
" if (a) {"
)
<<
Line
(
" {"
)
<<
Line
(
" foo;"
)
<<
Line
(
" }"
)
<<
Line
(
" } else {"
)
<<
Line
(
" {"
)
<<
Line
(
" foo;"
)
<<
Line
(
" }"
)
;
checkIndent
(
data
);
}
QTEST_APPLESS_MAIN
(
tst_CodeFormatter
)
#include
"tst_codeformatter.moc"
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment