forked from qt-creator/qt-creator
CppEditor: Fix trailing whitespace after extracting a function
... from a block of code. We must not insert an empty line into the newly created function, because it gets indented in the first indent operation, resulting in trailing characters after the actual code has been inserted later. Fixes: QTCREATORBUG-12118 Change-Id: If438d4de379cae90baa846c112866f2777b44fce Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -5627,6 +5627,26 @@ void CppEditorPlugin::test_quickfix_ExtractFunction_data()
|
||||
"{\n"
|
||||
" extracted(c);\n"
|
||||
"}\n");
|
||||
|
||||
QTest::newRow("if-block")
|
||||
<< _("inline void func()\n"
|
||||
"{\n"
|
||||
" int dummy = 0;\n"
|
||||
" @{start}if@{end} (dummy < 10) {\n"
|
||||
" ++dummy;\n"
|
||||
" }\n"
|
||||
"}\n")
|
||||
<< _("inline void extracted(int dummy)\n"
|
||||
"{\n"
|
||||
" if (dummy < 10) {\n"
|
||||
" ++dummy;\n"
|
||||
" }\n"
|
||||
"}\n\n"
|
||||
"inline void func()\n"
|
||||
"{\n"
|
||||
" int dummy = 0;\n"
|
||||
" extracted(dummy);\n"
|
||||
"}\n");
|
||||
}
|
||||
|
||||
void CppEditorPlugin::test_quickfix_ExtractFunction()
|
||||
|
||||
Reference in New Issue
Block a user