summaryrefslogtreecommitdiff
path: root/src/plugins/cpptools/cpprefactoringchanges.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/cpptools/cpprefactoringchanges.cpp')
-rw-r--r--src/plugins/cpptools/cpprefactoringchanges.cpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/plugins/cpptools/cpprefactoringchanges.cpp b/src/plugins/cpptools/cpprefactoringchanges.cpp
index 5ebd490ea6..509506d5a1 100644
--- a/src/plugins/cpptools/cpprefactoringchanges.cpp
+++ b/src/plugins/cpptools/cpprefactoringchanges.cpp
@@ -47,11 +47,14 @@ namespace CppTools {
class CppRefactoringChangesData : public TextEditor::RefactoringChangesData
{
- static std::unique_ptr<TextEditor::Indenter> createIndenter(QTextDocument *textDocument)
+ static std::unique_ptr<TextEditor::Indenter> createIndenter(const QString &fileName,
+ QTextDocument *textDocument)
{
TextEditor::ICodeStylePreferencesFactory *factory
= TextEditor::TextEditorSettings::codeStyleFactory(CppTools::Constants::CPP_SETTINGS_ID);
- return std::unique_ptr<TextEditor::Indenter>(factory->createIndenter(textDocument));
+ std::unique_ptr<TextEditor::Indenter> indenter(factory->createIndenter(textDocument));
+ indenter->setFileName(Utils::FilePath::fromString(fileName));
+ return indenter;
}
public:
@@ -69,7 +72,7 @@ public:
textDocument->indenter()->indent(selection, QChar::Null, textDocument->tabSettings());
} else {
const auto &tabSettings = ProjectExplorer::actualTabSettings(fileName, textDocument);
- auto indenter = createIndenter(selection.document());
+ auto indenter = createIndenter(fileName, selection.document());
indenter->indent(selection, QChar::Null, tabSettings);
}
}
@@ -82,7 +85,7 @@ public:
textDocument->indenter()->reindent(selection, textDocument->tabSettings());
} else {
const auto &tabSettings = ProjectExplorer::actualTabSettings(fileName, textDocument);
- auto indenter = createIndenter(selection.document());
+ auto indenter = createIndenter(fileName, selection.document());
indenter->reindent(selection, tabSettings);
}
}