[BUG_FIXED] Fix a regression due to a new feature of MRU (the feature is removed).
git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository/trunk@1312 f5eea248-9336-0410-98b8-ebc06183d4e3
This commit is contained in:
parent
611736b95d
commit
21d9cfb476
@ -3171,8 +3171,8 @@ void Notepad_plus::loadBufferIntoView(BufferID id, int whichOne, bool dontClose)
|
|||||||
|
|
||||||
bool Notepad_plus::removeBufferFromView(BufferID id, int whichOne)
|
bool Notepad_plus::removeBufferFromView(BufferID id, int whichOne)
|
||||||
{
|
{
|
||||||
DocTabView * tabToClose = (whichOne == MAIN_VIEW)?&_mainDocTab:&_subDocTab;
|
DocTabView * tabToClose = (whichOne == MAIN_VIEW) ? &_mainDocTab : &_subDocTab;
|
||||||
ScintillaEditView * viewToClose = (whichOne == MAIN_VIEW)?&_mainEditView:&_subEditView;
|
ScintillaEditView * viewToClose = (whichOne == MAIN_VIEW) ? &_mainEditView : &_subEditView;
|
||||||
|
|
||||||
//check if buffer exists
|
//check if buffer exists
|
||||||
int index = tabToClose->getIndexByBuffer(id);
|
int index = tabToClose->getIndexByBuffer(id);
|
||||||
@ -3202,28 +3202,18 @@ bool Notepad_plus::removeBufferFromView(BufferID id, int whichOne)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
BufferID bufferToActivate = NULL;
|
|
||||||
if (NppParameters::getInstance()->getNppGUI()._styleMRU) // If Most-Recently-Used mode:
|
|
||||||
{ // Activate Most-Recently-Used doc:
|
|
||||||
TaskListInfo taskListInfo;
|
|
||||||
::SendMessage(_pPublicInterface->getHSelf(), WM_GETTASKLISTINFO, (WPARAM)&taskListInfo, 0);
|
|
||||||
bufferToActivate = static_cast<BufferID>(taskListInfo._tlfsLst[1]._bufID);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{ // Activate next doc, otherwise previous if not possible:
|
|
||||||
int toActivate = 0;
|
int toActivate = 0;
|
||||||
if (active == tabToClose->nbItem() - 1) // If last doc:
|
//activate next doc, otherwise prev if not possible
|
||||||
|
if (active == tabToClose->nbItem() - 1) //prev
|
||||||
{
|
{
|
||||||
toActivate = active - 1; // Activate previous doc.
|
toActivate = active - 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
toActivate = active + 1; // Activate next doc.
|
toActivate = active; //activate the 'active' index. Since we remove the tab first, the indices shift (on the right side)
|
||||||
}
|
|
||||||
bufferToActivate = tabToClose->getBufferByIndex(toActivate);
|
|
||||||
}
|
}
|
||||||
tabToClose->deletItemAt((size_t)index); //delete first
|
tabToClose->deletItemAt((size_t)index); //delete first
|
||||||
activateBuffer(bufferToActivate, whichOne); //then activate. The prevent jumpy tab behaviour
|
activateBuffer(tabToClose->getBufferByIndex(toActivate), whichOne); //then activate. The prevent jumpy tab behaviour
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
Loading…
Reference in New Issue
Block a user