Keep spaceIndentCount for the current line to handle lambda expressions in multiline statements:

std::generate(data.begin(), data.end(),
              [&]() { return randval(engine); });
This commit is contained in:
Peter Vingelmann 2016-09-16 19:44:47 +02:00
parent 39a611a2e8
commit eb505347cb

View File

@ -2836,7 +2836,13 @@ void ASBeautifier::parseCurrentLine(const string& line)
if (lineBeginsWithOpenBracket || lineBeginsWithComma)
spaceIndentCount = 0;
}
else
// Do not zero the spaceIndentCount for the current line
// if we are within a statement. This is useful for lambda
// expressions in multiline statements:
//
// std::generate(data.begin(), data.end(),
// [&]() { return randval(engine); });
else if (!isInStatement || lineBeginsWithOpenBracket)
spaceIndentCount = 0;
}