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 <ulf.hermann@digia.com>
Reviewed-by: David Schulz <david.schulz@digia.com>
This commit is contained in:
Nikolai Kosjar
2013-11-21 11:15:26 +01:00
committed by David Schulz
parent 0ed2f4e5a2
commit d91d552c82
2 changed files with 7 additions and 5 deletions

View File

@@ -170,7 +170,7 @@ void CppEditorPlugin::test_doxygen_comments_data()
"bool preventFolding;\n" "bool preventFolding;\n"
"/*!\n" "/*!\n"
" * \\brief a\n" " * \\brief a\n"
" *\n" " * \n"
" */\n" " */\n"
"int a;\n" "int a;\n"
); );
@@ -197,7 +197,7 @@ void CppEditorPlugin::test_doxygen_comments_data()
"bool preventFolding;\n" "bool preventFolding;\n"
"/**\n" "/**\n"
" * @brief a\n" " * @brief a\n"
" *\n" " * \n"
" */\n" " */\n"
"int a;\n" "int a;\n"
); );
@@ -236,7 +236,7 @@ void CppEditorPlugin::test_doxygen_comments_data()
"bool preventFolding;\n" "bool preventFolding;\n"
"///\n" "///\n"
"/// \\brief a\n" "/// \\brief a\n"
"///\n" "/// \n"
"///\n" "///\n"
"int a;\n" "int a;\n"
); );
@@ -265,7 +265,7 @@ void CppEditorPlugin::test_doxygen_comments_data()
" bool preventFolding;\n" " bool preventFolding;\n"
" ///\n" " ///\n"
" /// \\brief a\n" " /// \\brief a\n"
" ///\n" " /// \n"
" ///\n" " ///\n"
" int a;\n" " int a;\n"
); );

View File

@@ -430,6 +430,7 @@ bool handleDoxygenCppStyleContinuation(QTextCursor &cursor,
const QString commentMarker = text.mid(offset, 3); const QString commentMarker = text.mid(offset, 3);
newLine.append(commentMarker); newLine.append(commentMarker);
newLine.append(QLatin1Char(' '));
cursor.insertText(newLine); cursor.insertText(newLine);
e->accept(); e->accept();
@@ -481,12 +482,13 @@ bool handleDoxygenContinuation(QTextCursor &cursor,
c.movePosition(QTextCursor::NextCharacter, QTextCursor::KeepAnchor, offset); c.movePosition(QTextCursor::NextCharacter, QTextCursor::KeepAnchor, offset);
newLine.append(c.selectedText()); newLine.append(c.selectedText());
if (text.at(offset) == QLatin1Char('/')) { if (text.at(offset) == QLatin1Char('/')) {
newLine.append(QLatin1String(" *")); newLine.append(QLatin1String(" * "));
} else { } else {
int start = offset; int start = offset;
while (offset < blockPos && text.at(offset) == QLatin1Char('*')) while (offset < blockPos && text.at(offset) == QLatin1Char('*'))
++offset; ++offset;
newLine.append(QString(offset - start, QLatin1Char('*'))); newLine.append(QString(offset - start, QLatin1Char('*')));
newLine.append(QLatin1Char(' '));
} }
cursor.insertText(newLine); cursor.insertText(newLine);
e->accept(); e->accept();