Commit 46a96c25 authored by Falco Hirschenberger's avatar Falco Hirschenberger Committed by Thorbjørn Lindeijer

Collapse or expand trailing whitespaces to one

Merge-request: 1823
Reviewed-by: default avatarThorbjørn Lindeijer <thorbjorn.lindeijer@nokia.com>
parent ec2b738d
......@@ -896,15 +896,19 @@ void BaseTextEditor::joinLineUpDown(bool up)
move.movePosition(QTextCursor::Up);
else
move.movePosition(QTextCursor::Down);
move.movePosition(QTextCursor::StartOfBlock);
move.movePosition(QTextCursor::EndOfBlock, QTextCursor::KeepAnchor);
QString cutLine = move.selectedText();
// collapse trailing whitespaces to one or insert whitespace
cutLine.replace(QRegExp("^\\s*"), " ");
move.movePosition(QTextCursor::Right, QTextCursor::KeepAnchor);
move.removeSelectedText();
move.clearSelection();
if(!up)
move.movePosition(QTextCursor::Up);
move.movePosition(QTextCursor::EndOfBlock);
move.insertText(cutLine);
move.endEditBlock();
......
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