From 88ee2bfb641c17ea5ad942558c9c9d40eb118a04 Mon Sep 17 00:00:00 2001 From: Lorenz Haas Date: Mon, 9 Feb 2015 20:06:27 +0100 Subject: [PATCH] CppEditor: Preserve indent during Doxygen continuation handling Change-Id: I30bba610fbe03fbfd9bc987805c57df6035d1c36 Reviewed-by: Nikolai Kosjar --- .../cppeditor/cppdocumentationcommenthelper.cpp | 2 +- src/plugins/cppeditor/cppdoxygen_test.cpp | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) 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"