mirror of
https://github.com/notepad-plus-plus/notepad-plus-plus.git
synced 2025-07-23 22:04:55 +02:00
Fix rename tab error msg while no change tab name
Fix #16661, close #16665
This commit is contained in:
parent
299d7cb26e
commit
5b26ef1ca8
@ -2085,6 +2085,9 @@ bool Notepad_plus::fileRename(BufferID bufferID)
|
|||||||
wchar_t *tabNewName = reinterpret_cast<wchar_t *>(strDlg.doDialog());
|
wchar_t *tabNewName = reinterpret_cast<wchar_t *>(strDlg.doDialog());
|
||||||
if (tabNewName)
|
if (tabNewName)
|
||||||
{
|
{
|
||||||
|
if (oldFileNamePath == tabNewName) // No change but user clicks on OK
|
||||||
|
return false;
|
||||||
|
|
||||||
wstring tabNewNameStr = tabNewName;
|
wstring tabNewNameStr = tabNewName;
|
||||||
trim(tabNewNameStr); // No leading and trailing space allowed
|
trim(tabNewNameStr); // No leading and trailing space allowed
|
||||||
|
|
||||||
@ -2110,10 +2113,12 @@ bool Notepad_plus::fileRename(BufferID bufferID)
|
|||||||
L"Rename failed",
|
L"Rename failed",
|
||||||
MB_OK | MB_ICONSTOP);
|
MB_OK | MB_ICONSTOP);
|
||||||
}
|
}
|
||||||
else
|
else // The change will be done here
|
||||||
{
|
{
|
||||||
_pluginsManager.notify(&scnN);
|
_pluginsManager.notify(&scnN); // send NPPN_FILEBEFORERENAME
|
||||||
|
|
||||||
buf->setFileName(tabNewNameStr.c_str());
|
buf->setFileName(tabNewNameStr.c_str());
|
||||||
|
|
||||||
scnN.nmhdr.code = NPPN_FILERENAMED;
|
scnN.nmhdr.code = NPPN_FILERENAMED;
|
||||||
_pluginsManager.notify(&scnN);
|
_pluginsManager.notify(&scnN);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user