CppEditor: fix indentation of auto-completed comments.

Fix indentation of auto-completed Doxygen comments, as well as auto-
leading characters from the block, to make it work with both spaces and
tabs.

Change-Id: I6c1c1665675cc25e01983e6d39b472f1b1c9683e
Reviewed-by: Leandro Melo <leandro.melo@nokia.com>
This commit is contained in:
Francois Ferrand
2012-03-13 15:13:05 +01:00
committed by Leandro Melo
parent 8e94d06496
commit cbc328e2d7
3 changed files with 8 additions and 11 deletions

View File

@@ -2381,7 +2381,10 @@ bool CPPEditorWidget::handleDocumentationComment(QKeyEvent *e)
if (followinPos == text.length()
|| text.at(followinPos) != QLatin1Char('*')) {
QString newLine(QLatin1Char('\n'));
newLine.append(QString(offset, QLatin1Char(' ')));
QTextCursor c(cursor);
c.movePosition(QTextCursor::StartOfBlock);
c.movePosition(QTextCursor::NextCharacter, QTextCursor::KeepAnchor, offset);
newLine.append(c.selectedText());
if (text.at(offset) == QLatin1Char('/')) {
newLine.append(QLatin1String(" *"));
} else {