forked from qt-creator/qt-creator
C++: Fix indentation of doxygen comment continuations
Align also after the leading asterisk. Fixes: QTCREATORBUG-11749 Change-Id: Ic054598c80206bf38b74345aed20d88486f57cad Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
@@ -235,6 +235,7 @@ bool handleDoxygenContinuation(QTextCursor &cursor,
|
|||||||
newLine.append(QLatin1String(" * "));
|
newLine.append(QLatin1String(" * "));
|
||||||
else
|
else
|
||||||
newLine.append(QLatin1String(" "));
|
newLine.append(QLatin1String(" "));
|
||||||
|
offset += 3;
|
||||||
} else {
|
} else {
|
||||||
// If '*' is not within a comment, skip.
|
// If '*' is not within a comment, skip.
|
||||||
QTextCursor cursorOnFirstNonWhiteSpace(cursor);
|
QTextCursor cursorOnFirstNonWhiteSpace(cursor);
|
||||||
@@ -249,8 +250,9 @@ bool handleDoxygenContinuation(QTextCursor &cursor,
|
|||||||
++offset;
|
++offset;
|
||||||
const QChar ch = leadingAsterisks ? QLatin1Char('*') : QLatin1Char(' ');
|
const QChar ch = leadingAsterisks ? QLatin1Char('*') : QLatin1Char(' ');
|
||||||
newLine.append(QString(offset - start, ch));
|
newLine.append(QString(offset - start, ch));
|
||||||
newLine.append(QLatin1Char(' '));
|
|
||||||
}
|
}
|
||||||
|
for (; offset < blockPos && currentLine.at(offset) == ' '; ++offset)
|
||||||
|
newLine.append(QLatin1Char(' '));
|
||||||
cursor.insertText(newLine);
|
cursor.insertText(newLine);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@@ -309,6 +309,34 @@ void DoxygenTest::testBasic_data()
|
|||||||
" public: void f();\n"
|
" public: void f();\n"
|
||||||
"};\n"
|
"};\n"
|
||||||
);
|
);
|
||||||
|
|
||||||
|
QTest::newRow("continuation_after_text_in_first_line") << _(
|
||||||
|
"bool preventFolding;\n"
|
||||||
|
"/*! leading comment|\n"
|
||||||
|
" */\n"
|
||||||
|
"int a;\n"
|
||||||
|
) << _(
|
||||||
|
"bool preventFolding;\n"
|
||||||
|
"/*! leading comment\n"
|
||||||
|
" * \n"
|
||||||
|
" */\n"
|
||||||
|
"int a;\n"
|
||||||
|
);
|
||||||
|
|
||||||
|
QTest::newRow("continuation_after_extra_indent") << _(
|
||||||
|
"bool preventFolding;\n"
|
||||||
|
"/*! leading comment\n"
|
||||||
|
" * cont|\n"
|
||||||
|
" */\n"
|
||||||
|
"int a;\n"
|
||||||
|
) << _(
|
||||||
|
"bool preventFolding;\n"
|
||||||
|
"/*! leading comment\n"
|
||||||
|
" * cont\n"
|
||||||
|
" * \n"
|
||||||
|
" */\n"
|
||||||
|
"int a;\n"
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DoxygenTest::testBasic()
|
void DoxygenTest::testBasic()
|
||||||
|
Reference in New Issue
Block a user