Commit f1736b07 authored by Nikolai Kosjar's avatar Nikolai Kosjar
Browse files

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: default avatarLorenz Haas <lykurg@gmail.com>
Reviewed-by: default avatarErik Verbruggen <erik.verbruggen@digia.com>
parent 546d2978
...@@ -919,7 +919,8 @@ void CppEditorPlugin::test_quickfix_InsertDefFromDecl_freeFunction() ...@@ -919,7 +919,8 @@ void CppEditorPlugin::test_quickfix_InsertDefFromDecl_freeFunction()
{ {
const QByteArray original = "void free()@;\n"; const QByteArray original = "void free()@;\n";
const QByteArray expected = const QByteArray expected =
"void free() {\n\n" "void free()\n"
"{\n\n"
"}\n" "}\n"
"\n" "\n"
; ;
...@@ -938,8 +939,8 @@ void CppEditorPlugin::test_quickfix_InsertDefFromDecl_insideClass() ...@@ -938,8 +939,8 @@ void CppEditorPlugin::test_quickfix_InsertDefFromDecl_insideClass()
"};"; "};";
const QByteArray expected = const QByteArray expected =
"class Foo {\n" "class Foo {\n"
" void bar() {\n" " void bar()\n"
"\n" " {\n\n"
" }\n" " }\n"
"};\n"; "};\n";
......
...@@ -2461,7 +2461,7 @@ public: ...@@ -2461,7 +2461,7 @@ public:
if (m_defpos == DefPosInsideClass) { if (m_defpos == DefPosInsideClass) {
const int targetPos = targetFile->position(m_loc.line(), m_loc.column()); const int targetPos = targetFile->position(m_loc.line(), m_loc.column());
ChangeSet target; 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->setChangeSet(target);
targetFile->appendIndentRange(ChangeSet::Range(targetPos, targetPos + 4)); targetFile->appendIndentRange(ChangeSet::Range(targetPos, targetPos + 4));
targetFile->setOpenEditor(true, targetPos); targetFile->setOpenEditor(true, targetPos);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment