Fix "Close All Unchanged" for sub-view

Fix #7708, close #7709
This commit is contained in:
Waldi Ravens 2019-12-07 14:50:36 +01:00 committed by Don HO
parent ff8e42ca1b
commit 9729fa7490
No known key found for this signature in database
GPG Key ID: 6C429F1D8D84F46E

View File

@ -1190,11 +1190,13 @@ bool Notepad_plus::fileCloseAllToRight()
bool Notepad_plus::fileCloseAllUnchanged() bool Notepad_plus::fileCloseAllUnchanged()
{ {
// Indexes must go from high to low to deal with the fact that when one index is closed, any remaining
// indexes (smaller than the one just closed) will point to the wrong tab.
std::vector<int> vecIndexesToClose; std::vector<int> vecIndexesToClose;
for (int i = int(_pDocTab->nbItem()) - 1; i >= 0; i--) for (int i = int(_pDocTab->nbItem()) - 1; i >= 0; i--)
{ {
BufferID id = _mainDocTab.getBufferByIndex(i); BufferID id = _pDocTab->getBufferByIndex(i);
Buffer* buf = MainFileManager.getBufferByID(id); Buffer* buf = MainFileManager.getBufferByID(id);
if ((buf->isUntitled() && buf->docLength() == 0) || !buf->isDirty()) if ((buf->isUntitled() && buf->docLength() == 0) || !buf->isDirty())
{ {