C++: Avoid trying to generate Doxygen when at end of file

Change-Id: I1fc126782bd88dd65ff83f50fc1dcf65e51a37ff
Reviewed-by: Erik Verbruggen <erik.verbruggen@nokia.com>
This commit is contained in:
Leandro Melo
2012-02-10 16:02:01 +01:00
parent 61bb1b9df8
commit 07d335b215

View File

@@ -2307,16 +2307,18 @@ bool CPPEditorWidget::handleDocumentationComment(QKeyEvent *e)
&& cursor.movePosition(QTextCursor::NextCharacter)) {
}
const QString &comment = doxygen.generate(cursor);
if (!comment.isEmpty()) {
cursor.beginEditBlock();
cursor.setPosition(pos);
cursor.insertText(comment);
cursor.setPosition(pos - 3, QTextCursor::KeepAnchor);
indent(document(), cursor, QChar::Null);
cursor.endEditBlock();
e->accept();
return true;
if (!cursor.atEnd()) {
const QString &comment = doxygen.generate(cursor);
if (!comment.isEmpty()) {
cursor.beginEditBlock();
cursor.setPosition(pos);
cursor.insertText(comment);
cursor.setPosition(pos - 3, QTextCursor::KeepAnchor);
indent(document(), cursor, QChar::Null);
cursor.endEditBlock();
e->accept();
return true;
}
}
cursor.setPosition(pos);
}