Commit 2c4eca61 authored by Milian Wolff's avatar Milian Wolff
Browse files

Fix porting bugs: KTextEditor::Range::start/end don't return refs.

parent a8d7c1bd
......@@ -155,16 +155,16 @@ QString SimpleRefactoring::moveIntoSource(const IndexedDeclaration& iDecl)
const QString prefixText = code->rangeText(prefixRange);
for (int i = prefixText.length() - 1; i >= 0 && prefixText.at(i).isSpace(); --i) {
if (headerRange.start().column() == 0) {
headerRange.start().setLine(headerRange.start().line() - 1);
headerRange.start() = headerRange.start() - KTextEditor::Cursor(1, 0);
if (headerRange.start().line() == prefixRange.start().line()) {
headerRange.start().setColumn(prefixRange.start().column() + i);
headerRange.start() = KTextEditor::Cursor(headerRange.start().line(), prefixRange.start().column() + i);
} else {
int lastNewline = prefixText.lastIndexOf('\n', i - 1);
headerRange.start().setColumn(i - lastNewline - 1);
headerRange.start() = KTextEditor::Cursor(headerRange.start().line(), i - lastNewline - 1);
qCWarning(CPP) << "UNSUPPORTED" << headerRange.start().column() << lastNewline << i << prefixText;
}
} else {
headerRange.start().setColumn(headerRange.start().column() - 1);
headerRange.start() = headerRange.start() - KTextEditor::Cursor(0, 1);
}
}
const QString body = code->rangeText(headerRange);
......
......@@ -273,7 +273,7 @@ KTextEditor::Range SourceCodeInsertion::insertionRange(int line)
{
range.start() = m_context->rangeInCurrentRevision().end();
if(range.start().column() > 0)
range.start().setColumn(range.start().column() - 1);
range.start() = range.start() - KTextEditor::Cursor(0, 1);
range.end() = range.start();
}
return range;
......
......@@ -473,14 +473,14 @@ QPair<TopDUContextPointer, KTextEditor::Range> CppLanguageSupport::importedConte
int pos = 0;
for(; pos < word.size(); ++pos) {
if(word[pos] == '"' || word[pos] == '<') {
wordRange.start().setColumn(++pos);
wordRange.start() = wordRange.start() + KTextEditor::Cursor(0, ++pos);
break;
}
}
for(; pos < word.size(); ++pos) {
if(word[pos] == '"' || word[pos] == '>') {
wordRange.end().setColumn(pos);
wordRange.end() = KTextEditor::Cursor(wordRange.end().line(), pos);
break;
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment