Browse Source

Enhance NPPN_GLOBALMODIFIED notification

The commit enhances 49e6957d48
pull/14778/head
Don Ho 9 months ago
parent
commit
9a6614ea98
  1. 7
      PowerEditor/src/MISC/PluginsManager/Notepad_plus_msgs.h
  2. 2
      PowerEditor/src/NppBigSwitch.cpp
  3. 5
      PowerEditor/src/ScintillaComponent/FindReplaceDlg.cpp

7
PowerEditor/src/MISC/PluginsManager/Notepad_plus_msgs.h

@ -1173,9 +1173,10 @@ enum Platform { PF_UNKNOWN, PF_X86, PF_X64, PF_IA64, PF_ARM64 };
//scnNotification->nmhdr.hwndFrom = hwndNpp;
//scnNotification->nmhdr.idFrom = BufferID; //where pluginMessage is pointer of type wchar_t
#define NPPN_GLOBALMODIFIED (NPPN_FIRST + 30) // To notify plugins that the current document is just modified by Replace All action. For solving the performance issue (from v8.6.4),
// Notepad++ doesn't trigger SCN_MODIFIED & other Scitilla notifications during Replace All action anymore.
// Plugin devs should monitor NPPN_GLOBALMODIFIED instead. This notification is implemented in Notepad++ v8.6.5.
#define NPPN_GLOBALMODIFIED (NPPN_FIRST + 30) // To notify plugins that the current document is just modified by Replace All action.
// For solving the performance issue (from v8.6.4), Notepad++ doesn't trigger SCN_MODIFIED during Replace All action anymore.
// As a result, the plugins which monitor SCN_MODIFIED should also monitor NPPN_GLOBALMODIFIED.
// This notification is implemented in Notepad++ v8.6.5.
//scnNotification->nmhdr.code = NPPN_GLOBALMODIFIED;
//scnNotification->nmhdr.hwndFrom = BufferID;
//scnNotification->nmhdr.idFrom = 0; // preserved for the future use, must be zero

2
PowerEditor/src/NppBigSwitch.cpp

@ -3520,7 +3520,7 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa
{
SCNotification scnN{};
scnN.nmhdr.code = NPPN_GLOBALMODIFIED;
scnN.nmhdr.hwndFrom = reinterpret_cast<void*>(_pEditView->getCurrentBuffer());
scnN.nmhdr.hwndFrom = reinterpret_cast<void*>(wParam);
scnN.nmhdr.idFrom = 0;
_pluginsManager.notify(&scnN);
return TRUE;

5
PowerEditor/src/ScintillaComponent/FindReplaceDlg.cpp

@ -2817,8 +2817,9 @@ int FindReplaceDlg::processAll(ProcessOperation op, const FindOption *opt, bool
(*_ppEditView)->execute(SCI_SETMODEVENTMASK, notifFlag);
if (op == ProcessReplaceAll && nbProcessed > 0) // All the notification of modification (SCN_MODIFIED) were removed during the operations, so we set modified status true here
{
(*_ppEditView)->getCurrentBuffer()->setModifiedStatus(true);
::SendMessage(_hParent, NPPM_INTERNAL_DOCMODIFIEDBYREPLACEALL, 0, 0);
Buffer* buf = (*_ppEditView)->getCurrentBuffer();
buf->setModifiedStatus(true);
::SendMessage(_hParent, NPPM_INTERNAL_DOCMODIFIEDBYREPLACEALL, reinterpret_cast<WPARAM>(buf), 0);
}

Loading…
Cancel
Save