From 060396c6988e278dbc10208099010947e72be6dc Mon Sep 17 00:00:00 2001 From: Don Ho Date: Mon, 4 Mar 2024 03:04:56 +0100 Subject: [PATCH] Fix NPPM_RELOADFILE API return wrong result issue Now NPPM_RELOADFILE returns the correct value: TRUE if reloading file succeeds, otherwise FALSE. Ref: https://community.notepad-plus-plus.org/topic/25533/nppm_reloadfile-should-return-true-_only_-on-success/4 --- PowerEditor/src/MISC/PluginsManager/Notepad_plus_msgs.h | 2 +- PowerEditor/src/NppBigSwitch.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/PowerEditor/src/MISC/PluginsManager/Notepad_plus_msgs.h b/PowerEditor/src/MISC/PluginsManager/Notepad_plus_msgs.h index 4071e07b4..50bac2e0f 100644 --- a/PowerEditor/src/MISC/PluginsManager/Notepad_plus_msgs.h +++ b/PowerEditor/src/MISC/PluginsManager/Notepad_plus_msgs.h @@ -288,7 +288,7 @@ enum Platform { PF_UNKNOWN, PF_X86, PF_X64, PF_IA64, PF_ARM64 }; // Reload the document which matches with the given filePathName2switch. // wParam: 0 (not used) // lParam[in]: filePathName2Reload is the full file path of document to reload - // Return TRUE + // Return TRUE if reloading file succeeds, otherwise FALSE #define NPPM_SWITCHTOFILE (NPPMSG + 37) // BOOL NPPM_SWITCHTOFILE(0, TCHAR* filePathName2switch) diff --git a/PowerEditor/src/NppBigSwitch.cpp b/PowerEditor/src/NppBigSwitch.cpp index 92f7ef22d..49910ea7a 100644 --- a/PowerEditor/src/NppBigSwitch.cpp +++ b/PowerEditor/src/NppBigSwitch.cpp @@ -682,7 +682,7 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa BufferID id = MainFileManager.getBufferFromName(longNameFullpath); if (id != BUFFER_INVALID) - doReload(id, wParam != 0); + result = doReload(id, wParam != 0); break; // For relaying this message to other plugin by calling "_pluginsManager.relayNppMessages(message, wParam, lParam)" at the end. }