From d91d552c822554c4ea6f0a24e13d4a1b6ff1de6f Mon Sep 17 00:00:00 2001 From: Nikolai Kosjar Date: Thu, 21 Nov 2013 11:15:26 +0100 Subject: [PATCH] CppEditor: Append extra ' ' in comment continuations ...for c style multiline comments and doxygens "///" and "//!". Task-number: QTCREATORBUG-10856 Change-Id: I84a4f95ba9e676991484e45bb0f64be996ac3be9 Reviewed-by: Ulf Hermann Reviewed-by: David Schulz --- src/plugins/cppeditor/cppdoxygen_test.cpp | 8 ++++---- src/plugins/cppeditor/cppeditor.cpp | 4 +++- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/plugins/cppeditor/cppdoxygen_test.cpp b/src/plugins/cppeditor/cppdoxygen_test.cpp index 56a75178ff7..ab8a9479406 100644 --- a/src/plugins/cppeditor/cppdoxygen_test.cpp +++ b/src/plugins/cppeditor/cppdoxygen_test.cpp @@ -170,7 +170,7 @@ void CppEditorPlugin::test_doxygen_comments_data() "bool preventFolding;\n" "/*!\n" " * \\brief a\n" - " *\n" + " * \n" " */\n" "int a;\n" ); @@ -197,7 +197,7 @@ void CppEditorPlugin::test_doxygen_comments_data() "bool preventFolding;\n" "/**\n" " * @brief a\n" - " *\n" + " * \n" " */\n" "int a;\n" ); @@ -236,7 +236,7 @@ void CppEditorPlugin::test_doxygen_comments_data() "bool preventFolding;\n" "///\n" "/// \\brief a\n" - "///\n" + "/// \n" "///\n" "int a;\n" ); @@ -265,7 +265,7 @@ void CppEditorPlugin::test_doxygen_comments_data() " bool preventFolding;\n" " ///\n" " /// \\brief a\n" - " ///\n" + " /// \n" " ///\n" " int a;\n" ); diff --git a/src/plugins/cppeditor/cppeditor.cpp b/src/plugins/cppeditor/cppeditor.cpp index 331c66946ce..63d5bc2e5b7 100644 --- a/src/plugins/cppeditor/cppeditor.cpp +++ b/src/plugins/cppeditor/cppeditor.cpp @@ -430,6 +430,7 @@ bool handleDoxygenCppStyleContinuation(QTextCursor &cursor, const QString commentMarker = text.mid(offset, 3); newLine.append(commentMarker); + newLine.append(QLatin1Char(' ')); cursor.insertText(newLine); e->accept(); @@ -481,12 +482,13 @@ bool handleDoxygenContinuation(QTextCursor &cursor, c.movePosition(QTextCursor::NextCharacter, QTextCursor::KeepAnchor, offset); newLine.append(c.selectedText()); if (text.at(offset) == QLatin1Char('/')) { - newLine.append(QLatin1String(" *")); + newLine.append(QLatin1String(" * ")); } else { int start = offset; while (offset < blockPos && text.at(offset) == QLatin1Char('*')) ++offset; newLine.append(QString(offset - start, QLatin1Char('*'))); + newLine.append(QLatin1Char(' ')); } cursor.insertText(newLine); e->accept();