From 9729fa749057b89e7e3459f794b74306c229c814 Mon Sep 17 00:00:00 2001 From: Waldi Ravens Date: Sat, 7 Dec 2019 14:50:36 +0100 Subject: [PATCH] Fix "Close All Unchanged" for sub-view Fix #7708, close #7709 --- PowerEditor/src/NppIO.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/PowerEditor/src/NppIO.cpp b/PowerEditor/src/NppIO.cpp index 1ec7176e3..4af2fc7c6 100644 --- a/PowerEditor/src/NppIO.cpp +++ b/PowerEditor/src/NppIO.cpp @@ -1190,11 +1190,13 @@ bool Notepad_plus::fileCloseAllToRight() 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 vecIndexesToClose; 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); if ((buf->isUntitled() && buf->docLength() == 0) || !buf->isDirty()) {