Revert "Preserve non-breaking space on saving text files"

The reverted patch resulted in corrupted text files that
had Unicode paragraph separators instead of newlines.
This reverts commit c6b6a6a077.

Change-Id: Ia2559937afefbe39213ac73551377220b8077cef
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
Christian Kandeler
2019-03-04 16:26:00 +01:00
committed by Eike Ziller
parent af318f9723
commit 15777d11ef
5 changed files with 6 additions and 6 deletions

View File

@@ -126,7 +126,7 @@ bool FixitsRefactoringFile::apply()
QString error;
for (auto it = m_documents.begin(); it != m_documents.end(); ++it) {
if (!m_textFileFormat.writeFile(it.key(), it.value()->toRawText(), &error)) {
if (!m_textFileFormat.writeFile(it.key(), it.value()->toPlainText(), &error)) {
qCDebug(fixitsLog) << "ERROR: Could not write file" << it.key() << ":" << error;
return false; // Error writing file
}

View File

@@ -117,7 +117,7 @@ bool JsonWizardGenerator::formatFile(const JsonWizard *wizard, GeneratedFile *fi
block = block.next();
}
}
file->setContents(doc.toRawText());
file->setContents(doc.toPlainText());
return true;
}

View File

@@ -277,7 +277,7 @@ void ProjectFileWizardExtension::applyCodeStyle(GeneratedFile *file) const
block = block.next();
}
}
file->setContents(doc.toRawText());
file->setContents(doc.toPlainText());
}
} // namespace Internal

View File

@@ -97,7 +97,7 @@ bool RefactoringChanges::createFile(const QString &fileName, const QString &cont
TextFileFormat format;
format.codec = EditorManager::defaultTextCodec();
QString error;
bool saveOk = format.writeFile(fileName, document->toRawText(), &error);
bool saveOk = format.writeFile(fileName, document->toPlainText(), &error);
delete document;
if (!saveOk)
return false;
@@ -367,7 +367,7 @@ bool RefactoringFile::apply()
QString error;
// suppress "file has changed" warnings if the file is open in a read-only editor
Core::FileChangeBlocker block(m_fileName);
if (!m_textFileFormat.writeFile(m_fileName, doc->toRawText(), &error)) {
if (!m_textFileFormat.writeFile(m_fileName, doc->toPlainText(), &error)) {
qWarning() << "Could not apply changes to" << m_fileName << ". Error: " << error;
result = false;
}

View File

@@ -569,7 +569,7 @@ bool TextDocument::save(QString *errorString, const QString &saveFileName, bool
}
}
const bool ok = write(fName, saveFormat, d->m_document.toRawText(), errorString);
const bool ok = write(fName, saveFormat, d->m_document.toPlainText(), errorString);
// restore text cursor and scroll bar positions
if (autoSave && undos < d->m_document.availableUndoSteps()) {