mirror of
https://github.com/notepad-plus-plus/notepad-plus-plus.git
synced 2025-07-27 15:54:17 +02:00
Fix encoding of nfo file cannot be changed bug
Fix #8823, fix #9153, fix #13905, close #15902
This commit is contained in:
parent
28244a5996
commit
dd0b557e14
@ -816,7 +816,10 @@ BufferID FileManager::loadFile(const wchar_t* filename, Document doc, int encodi
|
|||||||
newBuf->_timeStamp = fileNameTimestamp;
|
newBuf->_timeStamp = fileNameTimestamp;
|
||||||
|
|
||||||
// restore the encoding (ANSI based) while opening the existing file
|
// restore the encoding (ANSI based) while opening the existing file
|
||||||
newBuf->setEncoding(-1);
|
if (newBuf->_lang == L_ASCII)
|
||||||
|
newBuf->setEncoding(NPP_CP_DOS_437);
|
||||||
|
else
|
||||||
|
newBuf->setEncoding(-1);
|
||||||
|
|
||||||
// if not a large file, no file extension, and the language has been detected, we use the detected value
|
// if not a large file, no file extension, and the language has been detected, we use the detected value
|
||||||
if (!newBuf->_isLargeFile && ((newBuf->getLangType() == L_TEXT) && (loadedFileFormat._language != L_TEXT)))
|
if (!newBuf->_isLargeFile && ((newBuf->getLangType() == L_TEXT) && (loadedFileFormat._language != L_TEXT)))
|
||||||
|
@ -1859,12 +1859,11 @@ void ScintillaEditView::defineDocType(LangType typeDoc)
|
|||||||
setSpecialStyle(nfoStyle);
|
setSpecialStyle(nfoStyle);
|
||||||
execute(SCI_STYLECLEARALL);
|
execute(SCI_STYLECLEARALL);
|
||||||
|
|
||||||
Buffer * buf = MainFileManager.getBufferByID(_currentBufferID);
|
Buffer* buf = MainFileManager.getBufferByID(_currentBufferID);
|
||||||
|
|
||||||
if (buf->getEncoding() != NPP_CP_DOS_437)
|
if (buf->getEncoding() == NPP_CP_DOS_437)
|
||||||
{
|
{
|
||||||
buf->setEncoding(NPP_CP_DOS_437);
|
MainFileManager.reloadBuffer(buf);
|
||||||
::SendMessage(_hParent, WM_COMMAND, IDM_FILE_RELOAD, 0);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user