From d9eb3dc5a445e79f679b69a7ed96e360c582d6ef Mon Sep 17 00:00:00 2001 From: Christian Kandeler Date: Thu, 6 Aug 2020 10:54:17 +0200 Subject: [PATCH] CppEditor: Do not re-indent existing code ... in "Complete Switch Statement" quickfix. Fixes: QTCREATORBUG-12445 Change-Id: Ic168f5b434b81d2b5f5a0d344d6c6786a75d07a5 Reviewed-by: Christian Stenger --- src/plugins/cppeditor/cppquickfix_test.cpp | 4 ++-- src/plugins/cppeditor/cppquickfixes.cpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/plugins/cppeditor/cppquickfix_test.cpp b/src/plugins/cppeditor/cppquickfix_test.cpp index 71ed7ae6ba2..6d5097a4068 100644 --- a/src/plugins/cppeditor/cppquickfix_test.cpp +++ b/src/plugins/cppeditor/cppquickfix_test.cpp @@ -433,7 +433,7 @@ void CppEditorPlugin::test_quickfix_data() " EnumType t;\n" " @switch (t) {\n" " default:\n" - " break;\n" + " break;\n" " }\n" "}\n" ) << _( @@ -448,7 +448,7 @@ void CppEditorPlugin::test_quickfix_data() " case V2:\n" " break;\n" " default:\n" - " break;\n" + " break;\n" " }\n" "}\n" ); diff --git a/src/plugins/cppeditor/cppquickfixes.cpp b/src/plugins/cppeditor/cppquickfixes.cpp index 90283f32e4f..546824fdd6f 100644 --- a/src/plugins/cppeditor/cppquickfixes.cpp +++ b/src/plugins/cppeditor/cppquickfixes.cpp @@ -2700,7 +2700,7 @@ public: + values.join(QLatin1String(":\nbreak;\ncase ")) + QLatin1String(":\nbreak;")); currentFile->setChangeSet(changes); - currentFile->appendIndentRange(currentFile->range(compoundStatement)); + currentFile->appendIndentRange(ChangeSet::Range(start, start + 1)); currentFile->apply(); }