Revert "Fix detected language not being applied issue"

This reverts commit 6263ce5dece595543bbfaa4207391075ae3a212a for fixing the regression.

Fix #12226, fix #12253
This commit is contained in:
Don Ho 2022-10-05 00:06:57 +02:00
parent 23fc940a27
commit af0bc2e113

View File

@ -742,7 +742,7 @@ BufferID FileManager::loadFile(const TCHAR* filename, Document doc, int encoding
buf->setEncoding(-1); buf->setEncoding(-1);
// if no file extension, and the language has been detected, we use the detected value // if no file extension, and the language has been detected, we use the detected value
if (!newBuf->_isLargeFile && loadedFileFormat._language != L_TEXT) if (!newBuf->_isLargeFile && ((buf->getLangType() == L_TEXT) && (loadedFileFormat._language != L_TEXT)))
buf->setLangType(loadedFileFormat._language); buf->setLangType(loadedFileFormat._language);
setLoadedBufferEncodingAndEol(buf, UnicodeConvertor, loadedFileFormat._encoding, loadedFileFormat._eolFormat); setLoadedBufferEncodingAndEol(buf, UnicodeConvertor, loadedFileFormat._encoding, loadedFileFormat._eolFormat);