[NEW_BEHAVIOUR] File detection : Switch to modified or deleted file while user is asked to reload or keep the file.

git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository/trunk@631 f5eea248-9336-0410-98b8-ebc06183d4e3
remotes/x64
Don Ho 2010-04-20 19:30:50 +00:00
parent 5aab10a730
commit 0bb88d079b
3 changed files with 17 additions and 3 deletions

View File

@ -3926,11 +3926,19 @@ void Notepad_plus::notifyBufferChanged(Buffer * buffer, int mask) {
bool autoUpdate = (nppGUI._fileAutoDetection == cdAutoUpdate) || (nppGUI._fileAutoDetection == cdAutoUpdateGo2end);
if (!autoUpdate || buffer->isDirty())
{
// if file updating is not silently, we switch to the file to update.
int index = _pDocTab->getIndexByBuffer(buffer->getID());
int iView = currentView();
if (index == -1)
iView = otherView();
activateBuffer(buffer->getID(), iView); //activate the buffer in the first view possible
// Then we ask user to update
didDialog = true;
if (doReloadOrNot(buffer->getFullPathName(), buffer->isDirty()) != IDYES)
break; //abort
}
//activateBuffer(buffer->getID(), iView); //activate the buffer in the first view possible
doReload(buffer->getID(), false);
if (mainActive || subActive)
{
@ -3944,7 +3952,8 @@ void Notepad_plus::notifyBufferChanged(Buffer * buffer, int mask) {
int iView = currentView();
if (index == -1)
iView = otherView();
//activateBuffer(buffer->getID(), iView); //activate the buffer in the first view possible
activateBuffer(buffer->getID(), iView); //activate the buffer in the first view possible
didDialog = true;
if (doCloseOrNot(buffer->getFullPathName()) == IDNO)
{

View File

@ -182,6 +182,11 @@ public:
LRESULT init(HWND hwnd);
LRESULT process(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam);
void killAllChildren();
/*
HWND getWindowHandle() const {
return _pPublicInterface->getHSelf();
};
*/
enum comment_mode {cm_comment, cm_uncomment, cm_toggle};

View File

@ -343,7 +343,7 @@ void FileManager::checkFilesystemChanges() {
i = _nrBufs - 1;
}
_buffers[i]->checkFileState(); //something has changed. Triggers update automatically
_buffers[i]->checkFileState(); //something has changed. Triggers update automatically
}
}