[BUG_FIXED] (Author : Beetny) Fix "Close Window(s)" in Window dialog bug (if file is dirty and cancel to close).

git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository/trunk@600 f5eea248-9336-0410-98b8-ebc06183d4e3
This commit is contained in:
Don Ho 2010-01-19 23:30:16 +00:00
parent e96e419f74
commit 1f1ce89572

View File

@ -10178,15 +10178,27 @@ LRESULT Notepad_plus::runProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lPa
break; break;
case WDT_CLOSE: case WDT_CLOSE:
{ {
bool closed;
//loop through nmdlg->nItems, get index and close it //loop through nmdlg->nItems, get index and close it
for (int i = 0; i < (int)nmdlg->nItems; i++) { for (int i = 0; i < (int)nmdlg->nItems; i++)
fileClose(_pDocTab->getBufferByIndex(nmdlg->Items[i]), currentView()); {
closed = fileClose(_pDocTab->getBufferByIndex(nmdlg->Items[i]), currentView());
UINT pos = nmdlg->Items[i]; UINT pos = nmdlg->Items[i];
nmdlg->Items[i] = 0xFFFFFFFF; // indicate file was closed // The window list only needs to be rearranged when the file was actually closed
if (closed)
for (int j=i+1; j<(int)nmdlg->nItems; ++j) {
if (nmdlg->Items[j] > pos) nmdlg->Items[i] = 0xFFFFFFFF; // indicate file was closed
--nmdlg->Items[j];
// Shift the remaining items downward to fill the gap
for (int j = i + 1; j < (int)nmdlg->nItems; j++)
{
if (nmdlg->Items[j] > pos)
{
nmdlg->Items[j]--;
}
}
}
} }
nmdlg->processed = TRUE; nmdlg->processed = TRUE;
} }