mirror of
https://github.com/notepad-plus-plus/notepad-plus-plus.git
synced 2025-07-26 07:15:21 +02:00
Make NPPN_FILEBEFORERENAME notification more efficient
This commit is contained in:
parent
5b36e097c2
commit
9a27df8f13
@ -1874,7 +1874,6 @@ bool Notepad_plus::fileRename(BufferID id)
|
|||||||
scnN.nmhdr.code = NPPN_FILEBEFORERENAME;
|
scnN.nmhdr.code = NPPN_FILEBEFORERENAME;
|
||||||
scnN.nmhdr.hwndFrom = _pPublicInterface->getHSelf();
|
scnN.nmhdr.hwndFrom = _pPublicInterface->getHSelf();
|
||||||
scnN.nmhdr.idFrom = (uptr_t)bufferID;
|
scnN.nmhdr.idFrom = (uptr_t)bufferID;
|
||||||
_pluginsManager.notify(&scnN);
|
|
||||||
|
|
||||||
bool success = false;
|
bool success = false;
|
||||||
bool isFileExisting = PathFileExists(buf->getFullPathName()) != FALSE;
|
bool isFileExisting = PathFileExists(buf->getFullPathName()) != FALSE;
|
||||||
@ -1893,7 +1892,12 @@ bool Notepad_plus::fileRename(BufferID id)
|
|||||||
std::wstring fn = fDlg.doSaveDlg();
|
std::wstring fn = fDlg.doSaveDlg();
|
||||||
|
|
||||||
if (!fn.empty())
|
if (!fn.empty())
|
||||||
|
{
|
||||||
|
_pluginsManager.notify(&scnN);
|
||||||
success = MainFileManager.moveFile(bufferID, fn.c_str());
|
success = MainFileManager.moveFile(bufferID, fn.c_str());
|
||||||
|
scnN.nmhdr.code = success ? NPPN_FILERENAMED : NPPN_FILERENAMECANCEL;
|
||||||
|
_pluginsManager.notify(&scnN);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -1941,8 +1945,13 @@ bool Notepad_plus::fileRename(BufferID id)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
success = true;
|
_pluginsManager.notify(&scnN);
|
||||||
buf->setFileName(tabNewNameStr.c_str());
|
buf->setFileName(tabNewNameStr.c_str());
|
||||||
|
scnN.nmhdr.code = NPPN_FILERENAMED;
|
||||||
|
_pluginsManager.notify(&scnN);
|
||||||
|
|
||||||
|
success = true;
|
||||||
|
|
||||||
bool isSnapshotMode = NppParameters::getInstance().getNppGUI().isSnapshotMode();
|
bool isSnapshotMode = NppParameters::getInstance().getNppGUI().isSnapshotMode();
|
||||||
if (isSnapshotMode)
|
if (isSnapshotMode)
|
||||||
{
|
{
|
||||||
@ -1963,9 +1972,6 @@ bool Notepad_plus::fileRename(BufferID id)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
scnN.nmhdr.code = success ? NPPN_FILERENAMED : NPPN_FILERENAMECANCEL;
|
|
||||||
_pluginsManager.notify(&scnN);
|
|
||||||
|
|
||||||
return success;
|
return success;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user