Suppress multiple indents in template instantiation if line ends with <

This commit is contained in:
Peter Vingelmann 2016-09-22 22:55:55 +02:00
parent 27067bcbb5
commit 0933c3c033

View File

@ -1263,10 +1263,13 @@ void ASBeautifier::registerInStatementIndent(const string& line, int i, int spac
bool isLastProgramChar = (nextProgramChar == remainingCharNum); bool isLastProgramChar = (nextProgramChar == remainingCharNum);
char lastProgramChar = getLastProgramChar(line, i); char lastProgramChar = getLastProgramChar(line, i);
bool continuationLine = (lastProgramChar == '(');
if (!continuationLine && isInTemplateInstantiation)
continuationLine = (lastProgramChar == '<');
// Special rules if this is the last char in the line, or if the line // Special rules if this is the last char in the line, or if the line
// ends with '(' // ends with '('
if (isLastProgramChar || lastProgramChar == '(') if (isLastProgramChar || continuationLine)
{ {
int previousIndent = spaceTabCount_; int previousIndent = spaceTabCount_;
if (!inStatementIndentStack->empty()) if (!inStatementIndentStack->empty())
@ -1275,7 +1278,7 @@ void ASBeautifier::registerInStatementIndent(const string& line, int i, int spac
int currIndent = indentLength + previousIndent; int currIndent = indentLength + previousIndent;
// If the line ends with '(', then the next line will be a continuation // If the line ends with '(', then the next line will be a continuation
// of the current line, so we do not increase the previous indent // of the current line, so we do not increase the previous indent
if (lastProgramChar == '(' && previousIndent > spaceIndentCount) if (continuationLine && previousIndent > spaceIndentCount)
{ {
currIndent = previousIndent; currIndent = previousIndent;
} }