Utils: move text replacement helper to Utils::Text

Change-Id: I82b3304f91d575369e74d5f7404c189e14ba4730
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
David Schulz
2020-01-08 10:43:13 +01:00
parent 88edfdb1b2
commit c56e58fab4
6 changed files with 72 additions and 69 deletions

View File

@@ -150,7 +150,7 @@ void FixitsRefactoringFile::format(TextEditor::Indenter &indenter,
const int end = doc->findBlock(op.pos + op.length).blockNumber() + 1;
ranges.push_back({start, end});
}
const Replacements replacements = indenter.format(ranges);
const Text::Replacements replacements = indenter.format(ranges);
if (replacements.empty())
return;
@@ -201,7 +201,7 @@ void FixitsRefactoringFile::shiftAffectedReplacements(const ReplacementOperation
}
bool FixitsRefactoringFile::hasIntersection(const QString &fileName,
const Replacements &replacements,
const Text::Replacements &replacements,
int startIndex) const
{
for (int i = startIndex; i < m_replacementOperations.size(); ++i) {
@@ -212,7 +212,7 @@ bool FixitsRefactoringFile::hasIntersection(const QString &fileName,
// Usually the number of replacements is from 1 to 3.
if (std::any_of(replacements.begin(),
replacements.end(),
[&current](const Replacement &replacement) {
[&current](const Text::Replacement &replacement) {
return replacement.offset + replacement.length > current.pos
&& replacement.offset < current.pos + current.length;
})) {
@@ -224,7 +224,7 @@ bool FixitsRefactoringFile::hasIntersection(const QString &fileName,
}
void FixitsRefactoringFile::shiftAffectedReplacements(const QString &fileName,
const Replacements &replacements,
const Text::Replacements &replacements,
int startIndex)
{
for (int i = startIndex; i < m_replacementOperations.size(); ++i) {