Skip to content

Commit 8c8dcdb

Browse files
committed
qmdiEditor: trim only text from the end
Previous commit brake the document, as it removed leading space as well.
1 parent 36d4fe4 commit 8c8dcdb

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

src/widgets/qmdieditor.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -979,7 +979,8 @@ bool qmdiEditor::saveFile(const QString &newFileName) {
979979
auto currentText = block.text();
980980

981981
if (trimSpacesOnSave) {
982-
currentText = currentText.trimmed();
982+
auto static RE = QRegularExpression("\\s+$");
983+
currentText.remove(RE);
983984
if (currentText != block.text()) {
984985
cursor.setPosition(block.position());
985986
cursor.movePosition(QTextCursor::EndOfBlock, QTextCursor::KeepAnchor);

0 commit comments

Comments
 (0)