Fix the 1st document title "new 1" is not translated

1ae39c2dda (commitcomment-49174136)
pull/9778/head
Don HO 4 years ago
parent 1a9307b02d
commit 55de911be5

@ -497,9 +497,6 @@ void FileManager::init(Notepad_plus * pNotepadPlus, ScintillaEditView * pscratch
_pscratchTilla->execute(SCI_SETUNDOCOLLECTION, false); //dont store any undo information _pscratchTilla->execute(SCI_SETUNDOCOLLECTION, false); //dont store any undo information
_scratchDocDefault = (Document)_pscratchTilla->execute(SCI_GETDOCPOINTER); _scratchDocDefault = (Document)_pscratchTilla->execute(SCI_GETDOCPOINTER);
_pscratchTilla->execute(SCI_ADDREFDOCUMENT, 0, _scratchDocDefault); _pscratchTilla->execute(SCI_ADDREFDOCUMENT, 0, _scratchDocDefault);
NativeLangSpeaker *pNativeSpeaker = (NppParameters::getInstance()).getNativeLangSpeaker();
_untitled_str = pNativeSpeaker->getLocalizedStrFromID("tab-untitled-string", UNTITLED_STR);
} }
void FileManager::checkFilesystemChanges(bool bCheckOnlyCurrentBuffer) void FileManager::checkFilesystemChanges(bool bCheckOnlyCurrentBuffer)
@ -1087,7 +1084,8 @@ size_t FileManager::nextUntitledNewNumber() const
// if untitled document is invisible, then don't put its number into array (so its number is available to be used) // if untitled document is invisible, then don't put its number into array (so its number is available to be used)
if ((buf->_referees[0])->isVisible()) if ((buf->_referees[0])->isVisible())
{ {
TCHAR *numberStr = buf->_fileName + _untitled_str.length(); generic_string newTitle = ((NppParameters::getInstance()).getNativeLangSpeaker())->getLocalizedStrFromID("tab-untitled-string", UNTITLED_STR);
TCHAR *numberStr = buf->_fileName + newTitle.length();
int usedNumber = generic_atoi(numberStr); int usedNumber = generic_atoi(numberStr);
usedNumbers.push_back(usedNumber); usedNumbers.push_back(usedNumber);
} }
@ -1123,7 +1121,8 @@ size_t FileManager::nextUntitledNewNumber() const
BufferID FileManager::newEmptyDocument() BufferID FileManager::newEmptyDocument()
{ {
generic_string newTitle = _untitled_str; generic_string newTitle = ((NppParameters::getInstance()).getNativeLangSpeaker())->getLocalizedStrFromID("tab-untitled-string", UNTITLED_STR);
TCHAR nb[10]; TCHAR nb[10];
wsprintf(nb, TEXT("%d"), nextUntitledNewNumber()); wsprintf(nb, TEXT("%d"), nextUntitledNewNumber());
newTitle += nb; newTitle += nb;
@ -1140,7 +1139,7 @@ BufferID FileManager::newEmptyDocument()
BufferID FileManager::bufferFromDocument(Document doc, bool dontIncrease, bool dontRef) BufferID FileManager::bufferFromDocument(Document doc, bool dontIncrease, bool dontRef)
{ {
generic_string newTitle = _untitled_str; generic_string newTitle = ((NppParameters::getInstance()).getNativeLangSpeaker())->getLocalizedStrFromID("tab-untitled-string", UNTITLED_STR);
TCHAR nb[10]; TCHAR nb[10];
wsprintf(nb, TEXT("%d"), nextUntitledNewNumber()); wsprintf(nb, TEXT("%d"), nextUntitledNewNumber());
newTitle += nb; newTitle += nb;

@ -140,7 +140,6 @@ private:
std::vector<Buffer*> _buffers; std::vector<Buffer*> _buffers;
BufferID _nextBufferID = 0; BufferID _nextBufferID = 0;
size_t _nbBufs = 0; size_t _nbBufs = 0;
generic_string _untitled_str = UNTITLED_STR;
}; };
#define MainFileManager FileManager::getInstance() #define MainFileManager FileManager::getInstance()

Loading…
Cancel
Save