mirror of
https://github.com/notepad-plus-plus/notepad-plus-plus.git
synced 2025-07-27 07:44:24 +02:00
[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,12 +3171,12 @@ 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);
|
||||||
if (index == -1) //doesn't exist, done
|
if (index == -1) //doesn't exist, done
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
Buffer * buf = MainFileManager->getBufferByID(id);
|
Buffer * buf = MainFileManager->getBufferByID(id);
|
||||||
@ -3193,37 +3193,27 @@ bool Notepad_plus::removeBufferFromView(BufferID id, int whichOne)
|
|||||||
int active = tabToClose->getCurrentTabIndex();
|
int active = tabToClose->getCurrentTabIndex();
|
||||||
if (active == index) //need an alternative (close real doc, put empty one back)
|
if (active == index) //need an alternative (close real doc, put empty one back)
|
||||||
{
|
{
|
||||||
if (tabToClose->nbItem() == 1) //need alternative doc, add new one. Use special logic to prevent flicker of adding new tab then closing other
|
if (tabToClose->nbItem() == 1) //need alternative doc, add new one. Use special logic to prevent flicker of adding new tab then closing other
|
||||||
{
|
{
|
||||||
BufferID newID = MainFileManager->newEmptyDocument();
|
BufferID newID = MainFileManager->newEmptyDocument();
|
||||||
MainFileManager->addBufferReference(newID, viewToClose);
|
MainFileManager->addBufferReference(newID, viewToClose);
|
||||||
tabToClose->setBuffer(0, newID); //can safely use id 0, last (only) tab open
|
tabToClose->setBuffer(0, newID); //can safely use id 0, last (only) tab open
|
||||||
activateBuffer(newID, whichOne); //activate. DocTab already activated but not a problem
|
activateBuffer(newID, whichOne); //activate. DocTab already activated but not a problem
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
BufferID bufferToActivate = NULL;
|
int toActivate = 0;
|
||||||
if (NppParameters::getInstance()->getNppGUI()._styleMRU) // If Most-Recently-Used mode:
|
//activate next doc, otherwise prev if not possible
|
||||||
{ // Activate Most-Recently-Used doc:
|
if (active == tabToClose->nbItem() - 1) //prev
|
||||||
TaskListInfo taskListInfo;
|
{
|
||||||
::SendMessage(_pPublicInterface->getHSelf(), WM_GETTASKLISTINFO, (WPARAM)&taskListInfo, 0);
|
toActivate = active - 1;
|
||||||
bufferToActivate = static_cast<BufferID>(taskListInfo._tlfsLst[1]._bufID);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ // Activate next doc, otherwise previous if not possible:
|
{
|
||||||
int toActivate = 0;
|
toActivate = active; //activate the 'active' index. Since we remove the tab first, the indices shift (on the right side)
|
||||||
if (active == tabToClose->nbItem() - 1) // If last doc:
|
|
||||||
{
|
|
||||||
toActivate = active - 1; // Activate previous doc.
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
toActivate = active + 1; // Activate next doc.
|
|
||||||
}
|
|
||||||
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…
x
Reference in New Issue
Block a user