CppEditor: Fix doxygen continuation

... for the case where the cursor is on the first line of the comment.
At this point, we have just found out that no initial skeleton is to be
created and that we want to do a continuation instead. Therefore, we
need to rewind the cursor position, so handleDoxygenContinuation() will
receive the original cursor.

Fixes: QTCREATORBUG-20677
Change-Id: I42f1b83df624a9833fe13e1fa01e41c5c6c45334
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
Christian Kandeler
2020-11-05 15:47:35 +01:00
parent a68ec8ae24
commit 7116c7c60f
2 changed files with 16 additions and 0 deletions

View File

@@ -323,6 +323,7 @@ bool trySplitComment(TextEditor::TextEditorWidget *editorWidget,
cursor.endEditBlock();
return true;
}
cursor.setPosition(pos);
}
}
} // right after first doxygen comment

View File

@@ -81,6 +81,21 @@ void DoxygenTest::testBasic_data()
"int a;\n"
);
QTest::newRow("qt_style_cursor_before_existing_comment") << _(
"bool preventFolding;\n"
"/*!|\n"
" * \\brief something\n"
" */\n"
"int a;\n"
) << _(
"bool preventFolding;\n"
"/*!\n"
" * \n"
" * \\brief something\n"
" */\n"
"int a;\n"
);
QTest::newRow("qt_style_continuation") << _(
"bool preventFolding;\n"
"/*!\n"