From 5b26ef1ca867b57e63aa5421b534e42d3f5bc4a7 Mon Sep 17 00:00:00 2001 From: Don Ho Date: Wed, 11 Jun 2025 16:16:37 +0200 Subject: [PATCH] Fix rename tab error msg while no change tab name Fix #16661, close #16665 --- PowerEditor/src/NppIO.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/PowerEditor/src/NppIO.cpp b/PowerEditor/src/NppIO.cpp index 5cfb85688..ba68f7c92 100644 --- a/PowerEditor/src/NppIO.cpp +++ b/PowerEditor/src/NppIO.cpp @@ -2085,6 +2085,9 @@ bool Notepad_plus::fileRename(BufferID bufferID) wchar_t *tabNewName = reinterpret_cast(strDlg.doDialog()); if (tabNewName) { + if (oldFileNamePath == tabNewName) // No change but user clicks on OK + return false; + wstring tabNewNameStr = tabNewName; trim(tabNewNameStr); // No leading and trailing space allowed @@ -2110,10 +2113,12 @@ bool Notepad_plus::fileRename(BufferID bufferID) L"Rename failed", 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()); + scnN.nmhdr.code = NPPN_FILERENAMED; _pluginsManager.notify(&scnN);