CppEditor: Put '{' on new line for "Add Definition Inside Class"

...to be consistent with inserting "Outside Class" and "in xxx.cpp".

Change-Id: I32a43153d5d3bdec9fae0be731484a26b108c438
Reviewed-by: Lorenz Haas <lykurg@gmail.com>
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
This commit is contained in:
Nikolai Kosjar
2013-06-07 15:52:19 +02:00
parent 546d297856
commit f1736b079d
2 changed files with 5 additions and 4 deletions

View File

@@ -919,7 +919,8 @@ void CppEditorPlugin::test_quickfix_InsertDefFromDecl_freeFunction()
{
const QByteArray original = "void free()@;\n";
const QByteArray expected =
"void free() {\n\n"
"void free()\n"
"{\n\n"
"}\n"
"\n"
;
@@ -938,8 +939,8 @@ void CppEditorPlugin::test_quickfix_InsertDefFromDecl_insideClass()
"};";
const QByteArray expected =
"class Foo {\n"
" void bar() {\n"
"\n"
" void bar()\n"
" {\n\n"
" }\n"
"};\n";

View File

@@ -2461,7 +2461,7 @@ public:
if (m_defpos == DefPosInsideClass) {
const int targetPos = targetFile->position(m_loc.line(), m_loc.column());
ChangeSet target;
target.replace(targetPos - 1, targetPos, QLatin1String(" {\n\n}")); // replace ';'
target.replace(targetPos - 1, targetPos, QLatin1String("\n {\n\n}")); // replace ';'
targetFile->setChangeSet(target);
targetFile->appendIndentRange(ChangeSet::Range(targetPos, targetPos + 4));
targetFile->setOpenEditor(true, targetPos);