Fix changing "#include" lines after file renaming

Didn't work if there was any folded text before the #include.

Change-Id: I8f16205f06bfaa8b8541401a9ebd5995c15b2227
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
Reviewed-by: Daniel Teske <daniel.teske@theqtcompany.com>
This commit is contained in:
Daniel Teske
2015-10-01 14:54:31 +02:00
committed by Nikolai Kosjar
parent 5eb8fe0306
commit 307061032c
4 changed files with 96 additions and 3 deletions

View File

@@ -1113,7 +1113,7 @@ void CppModelManager::renameIncludes(const QString &oldFileName, const QString &
foreach (Snapshot::IncludeLocation loc, snapshot().includeLocationsOfDocument(oldFileName)) {
TextEditor::RefactoringFilePtr file = changes.file(loc.first->fileName());
const QTextBlock &block = file->document()->findBlockByLineNumber(loc.second - 1);
const QTextBlock &block = file->document()->findBlockByNumber(loc.second - 1);
const int replaceStart = block.text().indexOf(oldFileInfo.fileName());
if (replaceStart > -1) {
Utils::ChangeSet changeSet;