Skip to content
Snippets Groups Projects
Commit 7f21e8b2 authored by Orgad Shaneh's avatar Orgad Shaneh Committed by Orgad Shaneh
Browse files

VCS: Do not wrap lines that start with tab in submit editor


This breaks "Conflicts" section in Git, and possibly others

Change-Id: I821fd147194af0ce3902cedad02f373d6892e665
Reviewed-by: default avatarTobias Hunger <tobias.hunger@digia.com>
parent aa6dd83e
No related branches found
No related tags found
No related merge requests found
......@@ -34,6 +34,7 @@
#include <QDebug>
#include <QPointer>
#include <QTextBlock>
#include <QTimer>
#include <QScopedPointer>
......@@ -299,11 +300,21 @@ static QString wrappedText(const QTextEdit *e)
QTextCursor cursor(e->document());
cursor.movePosition(QTextCursor::Start);
while (!cursor.atEnd()) {
cursor.select(QTextCursor::LineUnderCursor);
rc += cursor.selectedText();
rc += newLine;
cursor.movePosition(QTextCursor::EndOfLine); // Mac needs it
cursor.movePosition(QTextCursor::NextCharacter);
const QString block = cursor.block().text();
if (block.startsWith(QLatin1Char('\t'))) { // Don't wrap
rc += block + newLine;
} else {
forever {
cursor.select(QTextCursor::LineUnderCursor);
rc += cursor.selectedText();
rc += newLine;
cursor.movePosition(QTextCursor::EndOfLine); // Mac needs it
if (cursor.atBlockEnd())
break;
cursor.movePosition(QTextCursor::NextCharacter);
}
}
cursor.movePosition(QTextCursor::NextBlock);
}
return rc;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment