Commit c3657634 authored by Roberto Raggi's avatar Roberto Raggi
Browse files

Added workaround for indentation not working when inserting text at the beginning of a range.

parent 23aa0af8
......@@ -35,6 +35,7 @@
#include <QtCore/QFile>
#include <QtCore/QSet>
#include <QtGui/QTextBlock>
#include <QtCore/QDebug>
using namespace TextEditor;
......@@ -97,7 +98,8 @@ QStringList RefactoringChanges::apply()
foreach (const Range &range, m_indentRangesByFile.value(fileName, QList<Range>())) {
QTextCursor start = editor->textCursor();
QTextCursor end = editor->textCursor();
start.setPosition(range.start);
// ### workaround for moving the textcursor when inserting text at the beginning of the range.
start.setPosition(qMax(0, range.start - 1));
end.setPosition(range.end);
cursorPairs.append(qMakePair(start, end));
}
......
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