diff --git a/clang/lib/Format/WhitespaceManager.cpp b/clang/lib/Format/WhitespaceManager.cpp index 805bb78f5c90e..6bfcebe73a165 100644 --- a/clang/lib/Format/WhitespaceManager.cpp +++ b/clang/lib/Format/WhitespaceManager.cpp @@ -372,6 +372,7 @@ AlignTokenSequence(const FormatStyle &Style, unsigned Start, unsigned End, (ScopeStack.size() == 1u && CurrentChange.NewlinesBefore > 0 && InsideNestedScope)) { LineShifted = true; + CurrentChange.IndentedFromColumn += Shift; CurrentChange.Spaces += Shift; } diff --git a/clang/unittests/Format/FormatTest.cpp b/clang/unittests/Format/FormatTest.cpp index 3ff784035dd44..bf69d0a56ebfc 100644 --- a/clang/unittests/Format/FormatTest.cpp +++ b/clang/unittests/Format/FormatTest.cpp @@ -20879,6 +20879,14 @@ TEST_F(FormatTest, AlignWithLineBreaks) { " };", Style); + verifyFormat("const char *const MatHtool[] = {};\n" + "const char Htool[] = \"@article{m,\\n\"\n" + " \" \"\n" + " \" \"\n" + " \" \"\n" + " \"}\\n\";", + Style); + Style.ColumnLimit = 15; verifyFormat("int i1 = 1;\n" "k = bar(\n"