mirror of
https://github.com/notepad-plus-plus/notepad-plus-plus.git
synced 2025-07-26 23:34:44 +02:00
Improve NPPM_ADDSCNMODIFIEDFLAGS API
Improve NPPM_ADDSCNMODIFIEDFLAGS API so plugins can call it anytime for taking the effect immediately. Ref: https://community.notepad-plus-plus.org/topic/26595/new-api-to-fix-eventual-regression-regarding-scn_modified-for-some-plugins/9?_=1738384417702
This commit is contained in:
parent
80319a71ee
commit
d888fb5f12
@ -992,9 +992,11 @@ enum Platform { PF_UNKNOWN, PF_X86, PF_X64, PF_IA64, PF_ARM64 };
|
||||
|
||||
#define NPPM_ADDSCNMODIFIEDFLAGS (NPPMSG + 117)
|
||||
// BOOL NPPM_ADDSCNMODIFIEDFLAGS(0, unsigned long scnMotifiedFlags2Add)
|
||||
// Add needed SCN_MODIFIED flags so your plugin will recieve the notification SCN_MODIFIED of these events for your specific treatments.
|
||||
// By default, Notepad++ only forwards SCN_MODIFIED with the following 5 flags/events SC_MOD_DELETETEXT | SC_MOD_INSERTTEXT | SC_PERFORMED_UNDO | SC_PERFORMED_REDO | SC_MOD_CHANGEINDICATOR to plugins.
|
||||
// If your plugin need to process other events of SCN_MODIFIED, you should add the flags you need by sending this message to Notepad++, just after recieving NPPN_READY.
|
||||
// Add the necessary SCN_MODIFIED flags so that your plugin will receive the SCN_MODIFIED notification for these events, enabling your specific treatments.
|
||||
// By default, Notepad++ only forwards SCN_MODIFIED with the following 5 flags/events:
|
||||
// SC_MOD_DELETETEXT | SC_MOD_INSERTTEXT | SC_PERFORMED_UNDO | SC_PERFORMED_REDO | SC_MOD_CHANGEINDICATOR to plugins.
|
||||
// If your plugin needs to process other SCN_MODIFIED events, you should add the required flags by sending this message to Notepad++. You can send it immediately after receiving NPPN_READY,
|
||||
// or only when your plugin needs to listen to specific events (to avoid penalizing Notepad++'s performance). Just ensure that the message is sent only once.
|
||||
// wParam: 0 (not used)
|
||||
// lParam[in]: scnMotifiedFlags2Add - Scintilla SCN_MODIFIED flags to add.
|
||||
// Return TRUE
|
||||
|
@ -3795,6 +3795,10 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa
|
||||
case NPPM_ADDSCNMODIFIEDFLAGS:
|
||||
{
|
||||
nppParam.addScintillaModEventMask(static_cast<unsigned long>(lParam));
|
||||
|
||||
auto newModEventMask = nppParam.getScintillaModEventMask();
|
||||
_mainEditView.execute(SCI_SETMODEVENTMASK, newModEventMask);
|
||||
_subEditView.execute(SCI_SETMODEVENTMASK, newModEventMask);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user