From 0933c3c033fd14d031ac59fdc86fbe2dd6d2c04a Mon Sep 17 00:00:00 2001 From: Peter Vingelmann Date: Thu, 22 Sep 2016 22:55:55 +0200 Subject: [PATCH] Suppress multiple indents in template instantiation if line ends with < --- src/ASBeautifier.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/ASBeautifier.cpp b/src/ASBeautifier.cpp index 1abf3fd..72895b8 100644 --- a/src/ASBeautifier.cpp +++ b/src/ASBeautifier.cpp @@ -1263,10 +1263,13 @@ void ASBeautifier::registerInStatementIndent(const string& line, int i, int spac bool isLastProgramChar = (nextProgramChar == remainingCharNum); 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 // ends with '(' - if (isLastProgramChar || lastProgramChar == '(') + if (isLastProgramChar || continuationLine) { int previousIndent = spaceTabCount_; if (!inStatementIndentStack->empty()) @@ -1275,7 +1278,7 @@ void ASBeautifier::registerInStatementIndent(const string& line, int i, int spac int currIndent = indentLength + previousIndent; // 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 - if (lastProgramChar == '(' && previousIndent > spaceIndentCount) + if (continuationLine && previousIndent > spaceIndentCount) { currIndent = previousIndent; }