diff --git a/src/plugins/cppeditor/cppfunctiondecldeflink.cpp b/src/plugins/cppeditor/cppfunctiondecldeflink.cpp index c6abbcc36a5..4fad2e652e2 100644 --- a/src/plugins/cppeditor/cppfunctiondecldeflink.cpp +++ b/src/plugins/cppeditor/cppfunctiondecldeflink.cpp @@ -271,7 +271,12 @@ void FunctionDeclDefLink::apply(CppEditorWidget *editor, bool jumpToMatch) const int jumpTarget = newTargetFile->position(targetFunction->line(), targetFunction->column()); newTargetFile->setOpenEditor(true, jumpTarget); } - newTargetFile->apply(changes(snapshot, targetStart)); + ChangeSet changeSet = changes(snapshot, targetStart); + for (ChangeSet::EditOp &op : changeSet.operationList()) { + if (op.type() == ChangeSet::EditOp::Replace) + op.setFormat1(true); + } + newTargetFile->apply(changeSet); } else { ToolTip::show(editor->toolTipPosition(linkSelection), Tr::tr("Target file was changed, could not apply changes")); diff --git a/src/plugins/texteditor/refactoringchanges.cpp b/src/plugins/texteditor/refactoringchanges.cpp index 2025d7bbf13..017474fe66d 100644 --- a/src/plugins/texteditor/refactoringchanges.cpp +++ b/src/plugins/texteditor/refactoringchanges.cpp @@ -357,6 +357,7 @@ void RefactoringFile::doFormatting() indenterOwner.reset(factory ? factory->createIndenter(document) : new PlainTextIndenter(document)); indenter = indenterOwner.get(); + indenter->setFileName(filePath()); tabSettings = TabSettings::settingsForFile(filePath()); } QTC_ASSERT(document, return);