Commit 793ef6a6 authored by Christian Kamm's avatar Christian Kamm
Browse files

C++ indenter: Fix 'else' indentation in GNU style.

parent fbf2efa5
......@@ -1006,6 +1006,8 @@ void QtStyleCodeFormatter::onEnter(int newState, int *indentDepth, int *savedInd
while (isBracelessState(state(outermostBraceless).type))
++outermostBraceless;
*indentDepth = state(outermostBraceless - 1).savedIndentDepth;
// this is where the else should go, if one appears - aligned to if_statement
*savedIndentDepth = state().savedIndentDepth;
} break;
case for_statement_paren_open:
......
......@@ -713,6 +713,13 @@ void tst_CodeFormatter::gnuStyle()
<< Line(" {")
<< Line(" fpp;")
<< Line(" }")
<< Line(" else if (b)")
<< Line(" {")
<< Line(" fpp;")
<< Line(" }")
<< Line(" else")
<< Line(" {")
<< Line(" }")
<< Line(" if (b) {")
<< Line(" fpp;")
<< Line(" }")
......
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