Commit 4ef2caca authored by mae's avatar mae
Browse files

Fix pasting of text that starts with a visually empty line

Creator only indents the first line, and reindents subsequent lines relative
to the indentation change of said first line. This fails when the first line
contains no non-space characters. Solution in this change: skip (visually) empty

Reviewed-by: thorbjorn
Task-number: QTCREATORBUG-227
parent f257f19b
......@@ -3415,6 +3415,16 @@ void BaseTextEditor::reindent(QTextDocument *doc, const QTextCursor &cursor)
const QTextBlock end = doc->findBlock(cursor.selectionEnd()).next();
const TabSettings &ts = d->m_document->tabSettings();
// skip empty blocks
while (block.isValid() && block != end) {
QString bt = block.text();
if (ts.firstNonSpace(bt) < bt.size())
indentBlock(doc, block, QChar::Null);
block =;
int previousIndentation = ts.indentationColumn(block.text());
indentBlock(doc, block, QChar::Null);
int currentIndentation = ts.indentationColumn(block.text());
Supports Markdown
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