mirror of
https://github.com/notepad-plus-plus/notepad-plus-plus.git
synced 2025-07-23 22:04:55 +02:00
Fix Default Language not working for the 1st empty file with empty session
Fix #12586
This commit is contained in:
parent
f400b682b5
commit
c63cc6f219
@ -679,6 +679,7 @@ BufferID FileManager::loadFile(const TCHAR* filename, Document doc, int encoding
|
|||||||
{
|
{
|
||||||
pPath = backupFileName;
|
pPath = backupFileName;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pPath)
|
if (pPath)
|
||||||
{
|
{
|
||||||
FILE* fp = generic_fopen(pPath, TEXT("rb"));
|
FILE* fp = generic_fopen(pPath, TEXT("rb"));
|
||||||
@ -1312,7 +1313,8 @@ BufferID FileManager::newEmptyDocument()
|
|||||||
|
|
||||||
BufferID FileManager::bufferFromDocument(Document doc, bool dontIncrease, bool dontRef)
|
BufferID FileManager::bufferFromDocument(Document doc, bool dontIncrease, bool dontRef)
|
||||||
{
|
{
|
||||||
generic_string newTitle = ((NppParameters::getInstance()).getNativeLangSpeaker())->getLocalizedStrFromID("tab-untitled-string", UNTITLED_STR);
|
NppParameters& nppParamInst = NppParameters::getInstance();
|
||||||
|
generic_string newTitle = (nppParamInst.getNativeLangSpeaker())->getLocalizedStrFromID("tab-untitled-string", UNTITLED_STR);
|
||||||
TCHAR nb[10];
|
TCHAR nb[10];
|
||||||
wsprintf(nb, TEXT("%d"), static_cast<int>(nextUntitledNewNumber()));
|
wsprintf(nb, TEXT("%d"), static_cast<int>(nextUntitledNewNumber()));
|
||||||
newTitle += nb;
|
newTitle += nb;
|
||||||
@ -1322,6 +1324,8 @@ BufferID FileManager::bufferFromDocument(Document doc, bool dontIncrease, bool d
|
|||||||
Buffer* newBuf = new Buffer(this, _nextBufferID, doc, DOC_UNNAMED, newTitle.c_str(), false);
|
Buffer* newBuf = new Buffer(this, _nextBufferID, doc, DOC_UNNAMED, newTitle.c_str(), false);
|
||||||
BufferID id = static_cast<BufferID>(newBuf);
|
BufferID id = static_cast<BufferID>(newBuf);
|
||||||
newBuf->_id = id;
|
newBuf->_id = id;
|
||||||
|
const NewDocDefaultSettings& ndds = (nppParamInst.getNppGUI()).getNewDocDefaultSettings();
|
||||||
|
newBuf->_lang = ndds._lang;
|
||||||
_buffers.push_back(newBuf);
|
_buffers.push_back(newBuf);
|
||||||
++_nbBufs;
|
++_nbBufs;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user