aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/cppeditor/cppquickfixes.cpp
diff options
context:
space:
mode:
authorChristian Kandeler <christian.kandeler@qt.io>2020-07-22 16:37:18 +0200
committerChristian Kandeler <christian.kandeler@qt.io>2020-07-23 09:00:44 +0000
commite4100c31fc2cf1e96a70a4a9783e46e94e869c64 (patch)
treeae27b0dfa0782ef832a0be04d637018b42448853 /src/plugins/cppeditor/cppquickfixes.cpp
parent086a4be7343c01876fbad32ad76f2920f9f8989c (diff)
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>
Diffstat (limited to 'src/plugins/cppeditor/cppquickfixes.cpp')
-rw-r--r--src/plugins/cppeditor/cppquickfixes.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/plugins/cppeditor/cppquickfixes.cpp b/src/plugins/cppeditor/cppquickfixes.cpp
index 8c65166aa1..e259810182 100644
--- a/src/plugins/cppeditor/cppquickfixes.cpp
+++ b/src/plugins/cppeditor/cppquickfixes.cpp
@@ -3885,7 +3885,7 @@ public:
funcDef.append(QLatin1String(" const"));
funcDecl.append(QLatin1String(" const"));
}
- funcDef.append(QLatin1String("\n{\n"));
+ funcDef.append(QLatin1String("\n{"));
if (matchingClass)
funcDecl.append(QLatin1String(";\n"));
if (m_funcReturn) {
@@ -3925,7 +3925,7 @@ public:
QTC_ASSERT(tc.hasSelection(), return);
position = tc.selectionEnd() + 1;
change.clear();
- change.insert(position, extract);
+ change.insert(position, extract + '\n');
currentFile->setChangeSet(change);
currentFile->appendReindentRange(ChangeSet::Range(position, position + 1));
currentFile->apply();