mirror of
https://github.com/notepad-plus-plus/notepad-plus-plus.git
synced 2025-07-27 07:44:24 +02:00
Merge pull request #1 from g3candy/g3candy-empty-file-endings
empty files line endings #461
This commit is contained in:
commit
2a589c820a
@ -510,13 +510,11 @@ BufferID FileManager::loadFile(const TCHAR * filename, Document doc, int encodin
|
|||||||
if (nullptr != UnicodeConvertor.getNewBuf())
|
if (nullptr != UnicodeConvertor.getNewBuf())
|
||||||
{
|
{
|
||||||
int format = getEOLFormatForm(UnicodeConvertor.getNewBuf(), UnicodeConvertor.getNewSize());
|
int format = getEOLFormatForm(UnicodeConvertor.getNewBuf(), UnicodeConvertor.getNewSize());
|
||||||
buf->setFormat(format == -1?WIN_FORMAT:(formatType)format);
|
if( format != -1 )
|
||||||
}
|
buf->setFormat((formatType)format);
|
||||||
else
|
|
||||||
{
|
|
||||||
buf->setFormat(WIN_FORMAT);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
UniMode um = UnicodeConvertor.getEncoding();
|
UniMode um = UnicodeConvertor.getEncoding();
|
||||||
if (um == uni7Bit)
|
if (um == uni7Bit)
|
||||||
{
|
{
|
||||||
@ -536,6 +534,7 @@ BufferID FileManager::loadFile(const TCHAR * filename, Document doc, int encodin
|
|||||||
// Test if encoding is set to UTF8 w/o BOM (usually for utf8 indicator of xml or html)
|
// Test if encoding is set to UTF8 w/o BOM (usually for utf8 indicator of xml or html)
|
||||||
buf->setEncoding((encoding == SC_CP_UTF8)?-1:encoding);
|
buf->setEncoding((encoding == SC_CP_UTF8)?-1:encoding);
|
||||||
buf->setUnicodeMode(uniCookie);
|
buf->setUnicodeMode(uniCookie);
|
||||||
|
if ( format != -1 )
|
||||||
buf->setFormat(format);
|
buf->setFormat(format);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -569,17 +568,16 @@ bool FileManager::reloadBuffer(BufferID id)
|
|||||||
if (nullptr != UnicodeConvertor.getNewBuf())
|
if (nullptr != UnicodeConvertor.getNewBuf())
|
||||||
{
|
{
|
||||||
int format = getEOLFormatForm(UnicodeConvertor.getNewBuf(), UnicodeConvertor.getNewSize());
|
int format = getEOLFormatForm(UnicodeConvertor.getNewBuf(), UnicodeConvertor.getNewSize());
|
||||||
buf->setFormat(format == -1?WIN_FORMAT:(formatType)format);
|
if( format != -1 )
|
||||||
}
|
buf->setFormat((formatType)format);
|
||||||
else
|
|
||||||
{
|
|
||||||
buf->setFormat(WIN_FORMAT);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
buf->setUnicodeMode(UnicodeConvertor.getEncoding());
|
buf->setUnicodeMode(UnicodeConvertor.getEncoding());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
buf->setEncoding(encoding);
|
buf->setEncoding(encoding);
|
||||||
|
if ( format != - 1)
|
||||||
buf->setFormat(format);
|
buf->setFormat(format);
|
||||||
buf->setUnicodeMode(uniCookie);
|
buf->setUnicodeMode(uniCookie);
|
||||||
}
|
}
|
||||||
@ -1264,7 +1262,7 @@ inline bool FileManager::loadFileData(Document doc, const TCHAR * filename, char
|
|||||||
|
|
||||||
if (pFormat != NULL)
|
if (pFormat != NULL)
|
||||||
{
|
{
|
||||||
*pFormat = (format == -1)?WIN_FORMAT:(formatType)format;
|
*pFormat = (formatType)format;
|
||||||
}
|
}
|
||||||
_pscratchTilla->execute(SCI_EMPTYUNDOBUFFER);
|
_pscratchTilla->execute(SCI_EMPTYUNDOBUFFER);
|
||||||
_pscratchTilla->execute(SCI_SETSAVEPOINT);
|
_pscratchTilla->execute(SCI_SETSAVEPOINT);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user