diff --git a/src/plugins/cppeditor/cppdocumentationcommenthelper.cpp b/src/plugins/cppeditor/cppdocumentationcommenthelper.cpp index 63ddc929ed8..37df46a4556 100644 --- a/src/plugins/cppeditor/cppdocumentationcommenthelper.cpp +++ b/src/plugins/cppeditor/cppdocumentationcommenthelper.cpp @@ -176,7 +176,7 @@ bool handleDoxygenCppStyleContinuation(QTextCursor &cursor) return false; QString newLine(QLatin1Char('\n')); - newLine.append(QString(offset, QLatin1Char(' '))); // indent correctly + newLine.append(text.left(offset)); // indent correctly newLine.append(commentMarker); newLine.append(QLatin1Char(' ')); diff --git a/src/plugins/cppeditor/cppdoxygen_test.cpp b/src/plugins/cppeditor/cppdoxygen_test.cpp index 6a258f2dfc8..01fc5bf2a8f 100644 --- a/src/plugins/cppeditor/cppdoxygen_test.cpp +++ b/src/plugins/cppeditor/cppdoxygen_test.cpp @@ -205,6 +205,17 @@ void DoxygenTest::testBasic_data() " int a;\n" ); + QTest::newRow("cpp_styleA_indented_preserve_mixed_indention_continuation") << _( + "\t bool preventFolding;\n" + "\t /// \brief a|\n" + "\t int a;\n" + ) << _( + "\t bool preventFolding;\n" + "\t /// \brief a\n" + "\t /// \n" + "\t int a;\n" + ); + /// test cpp style doxygen comment continuation when inside a indented scope QTest::newRow("cpp_styleA_indented_continuation") << _( " bool preventFolding;\n"