[BUG_FIXED] Fix inconsistant untitled name issue.
The inconsistant untitled name issue is the first untitled document name is "new 0" or "new 2" instead of "new 1". This fix make the first untitled document name always be "new 1".
This commit is contained in:
parent
5e052c5bd0
commit
24c557392f
|
@ -1052,9 +1052,13 @@ size_t FileManager::nextUntitledNewNumber() const
|
|||
Buffer *buf = _buffers.at(i);
|
||||
if (buf->isUntitled())
|
||||
{
|
||||
TCHAR *numberStr = buf->_fileName + lstrlen(UNTITLED_STR);
|
||||
int usedNumber = generic_atoi(numberStr);
|
||||
usedNumbers.push_back(usedNumber);
|
||||
// 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())
|
||||
{
|
||||
TCHAR *numberStr = buf->_fileName + lstrlen(UNTITLED_STR);
|
||||
int usedNumber = generic_atoi(numberStr);
|
||||
usedNumbers.push_back(usedNumber);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1106,7 +1110,7 @@ BufferID FileManager::bufferFromDocument(Document doc, bool dontIncrease, bool d
|
|||
{
|
||||
generic_string newTitle = UNTITLED_STR;
|
||||
TCHAR nb[10];
|
||||
wsprintf(nb, TEXT("%d"), 0);
|
||||
wsprintf(nb, TEXT("%d"), nextUntitledNewNumber());
|
||||
newTitle += nb;
|
||||
|
||||
if (!dontRef)
|
||||
|
|
|
@ -346,7 +346,7 @@ private :
|
|||
bool _needLexer; //initially true
|
||||
//these properties have to be duplicated because of multiple references
|
||||
//All the vectors must have the same size at all times
|
||||
std::vector< ScintillaEditView * > _referees;
|
||||
std::vector< ScintillaEditView * > _referees; // Instances of ScintillaEditView which contain this buffer
|
||||
std::vector< Position > _positions;
|
||||
std::vector< std::vector<size_t> > _foldStates;
|
||||
|
||||
|
|
Loading…
Reference in New Issue