Add option to configure file line ending for an open document

Add into the text editor toolbar a combo box which allows to change
the line endings for an open document.
The supported line endings are LF and CRLF.

Change-Id: I029ba7867e0087b162edba7aba1bd1d1e966fd69
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
Reviewed-by: André Hartmann <aha_1980@gmx.de>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
Marius Sincovici
2019-07-13 06:27:17 +02:00
parent 5edb390bac
commit a96ed0d4a0
6 changed files with 54 additions and 0 deletions

View File

@@ -101,6 +101,11 @@ void BaseTextDocument::setSupportsUtf8Bom(bool value)
d->m_supportsUtf8Bom = value;
}
void BaseTextDocument::setLineTerminationMode(Utils::TextFileFormat::LineTerminationMode mode)
{
d->m_format.lineTerminationMode = mode;
}
/*!
Autodetects format and reads in the text file specified by \a fileName.
*/
@@ -149,6 +154,11 @@ bool BaseTextDocument::supportsUtf8Bom() const
return d->m_supportsUtf8Bom;
}
Utils::TextFileFormat::LineTerminationMode BaseTextDocument::lineTerminationMode() const
{
return d->m_format.lineTerminationMode;
}
/*!
Returns the format obtained from the last call to \c read().
*/