diff --git a/PowerEditor/src/Notepad_plus.cpp b/PowerEditor/src/Notepad_plus.cpp index 4b6671415..899a0e1e5 100644 --- a/PowerEditor/src/Notepad_plus.cpp +++ b/PowerEditor/src/Notepad_plus.cpp @@ -3578,21 +3578,23 @@ bool Notepad_plus::removeBufferFromView(BufferID id, int whichOne) { toActivate = active; //activate the 'active' index. Since we remove the tab first, the indices shift (on the right side) } + if (NppParameters::getInstance().getNppGUI()._styleMRU) { // After closing a file choose the file to activate based on MRU list and not just last file in the list. TaskListInfo taskListInfo; - ::SendMessage(_pPublicInterface->getHSelf(), WM_GETTASKLISTINFO, (WPARAM)&taskListInfo, 0); + ::SendMessage(_pPublicInterface->getHSelf(), WM_GETTASKLISTINFO, reinterpret_cast(&taskListInfo), 0); size_t i, n = taskListInfo._tlfsLst.size(); for (i = 0; i < n; i++) { - TaskLstFnStatus& F = taskListInfo._tlfsLst[i]; - if (F._iView != whichOne || F._bufID == (void*)id) + TaskLstFnStatus& tfs = taskListInfo._tlfsLst[i]; + if (tfs._iView != whichOne || tfs._bufID == id) continue; - toActivate = F._docIndex >= active ? F._docIndex - 1 : F._docIndex; + toActivate = tfs._docIndex >= active ? tfs._docIndex - 1 : tfs._docIndex; break; } } + tabToClose->deletItemAt((size_t)index); //delete first _isFolding = true; // So we can ignore events while folding is taking place activateBuffer(tabToClose->getBufferByIndex(toActivate), whichOne); //then activate. The prevent jumpy tab behaviour