Skip to content

Commit

Permalink
Merge branch 'npp_official_svn' into jl/LH-45/integrate-npp-svn
Browse files Browse the repository at this point in the history
[NEW_BEHAVIOUR] File detection : Switch to modified or deleted file while user is asked to reload or keep the file.

Conflicts:
	PowerEditor/src/Notepad_plus.cpp

[#45]

Signed-off-by: Jocelyn Legault <jocelynlegault@gmail.com>
  • Loading branch information
joce committed Oct 3, 2010
2 parents a830f51 + 8d6a793 commit 3d12e0f
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 2 deletions.
16 changes: 15 additions & 1 deletion PowerEditor/src/Notepad_plus.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4385,11 +4385,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)
{
Expand All @@ -4399,6 +4407,12 @@ void Notepad_plus::notifyBufferChanged(Buffer * buffer, int mask)
}
case DOC_DELETED: //ask for keep
{
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
didDialog = true;
if (doCloseOrNot(buffer->getFullPathName()) == IDNO)
{
Expand Down
5 changes: 5 additions & 0 deletions PowerEditor/src/Notepad_plus.h
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,11 @@ friend class Notepad_plus_Window;
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};

Expand Down
2 changes: 1 addition & 1 deletion PowerEditor/src/ScintillaComponent/Buffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,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
}

}
Expand Down

0 comments on commit 3d12e0f

Please sign in to comment.