Notepad++ v8.7.6 released
-
@donho said in Notepad++ v8.7.6 released:
NPPM_ADDSCINTILLANOTIF
Does this mean that a plugin registers with this new message when starting for certain notifications?
-
@Ekopalypse said in Notepad++ v8.7.6 released:
@donho said in Notepad++ v8.7.6 released:
NPPM_ADDSCINTILLANOTIF
Does this mean that a plugin registers with this new message when starting for certain notifications?
Yes
-
ok, so just to be sure I understand this correctly, in my case I would call
::SendMessage(nppData._nppHandle, NPPM_ADDSCINTILLANOTIFS, 0, SC_MOD_BEFOREDELETE | SC_MOD_BEFOREINSERT);
to reactivate these notifications?
And does this mean that these notifications are then globally available again? That is, if NppLspClient reactivates them, can PythonScript use them again? Or are they then only forwarded to the respective plugin? -
@Ekopalypse said in Notepad++ v8.7.6 released:
ok, so just to be sure I understand this correctly, in my case I would call
::SendMessage(nppData._nppHandle, NPPM_ADDSCINTILLANOTIFS, 0, SC_MOD_BEFOREDELETE | SC_MOD_BEFOREINSERT);
to reactivate these notifications?
And does this mean that these notifications are then globally available again?Yes.
That is, if NppLspClient reactivates them, can PythonScript use them again?
Yes. But one plugin should not depend on other plugins’ registration.
Or are they then only forwarded to the respective plugin?
No.
By default,
MODEVENTMASK_ON
will contain the value SC_MOD_DELETETEXT | SC_MOD_INSERTTEXT | SC_PERFORMED_UNDO | SC_PERFORMED_REDO | SC_MOD_CHANGEINDICATORIn the case that both Columns++ & NppLspClient are installed and both plugins have integrated
NPPM_ADDSCINTILLANOTIFS
message, and NppLspClient is loaded after Columns++:After Columns++'s registration,
MODEVENTMASK_ON
will contain the value SC_MOD_DELETETEXT | SC_MOD_INSERTTEXT | SC_PERFORMED_UNDO | SC_PERFORMED_REDO | SC_MOD_CHANGEINDICATOR | SC_MOD_DELETETEXT | SC_MOD_INSERTTEXT.But after NppLspClient’s registration, the value becomes SC_MOD_DELETETEXT | SC_MOD_INSERTTEXT | SC_PERFORMED_UNDO | SC_PERFORMED_REDO | SC_MOD_CHANGEINDICATOR | SC_MOD_DELETETEXT | SC_MOD_INSERTTEXT | SC_MOD_BEFOREDELETE | SC_MOD_BEFOREINSERT.
And the latest registered value will be sent globally for all installed plugins.
Btw, fun fact, isn’t there a law in France against deliberate obsolescence :-D
I ensure you that it’s not deliberate obsolescence.
Notepad++'s code is biodegradable ;) -
@donho said in Notepad++ v8.7.6 released:
Thank you, that sounds good to me.
Notepad++'s code is biodegradable ;)
Nice to know, I already have enough hazardous waste with my rusty code :-D
-
@donho said in Notepad++ v8.7.6 released:
The change is for enhancing large files’ syntax highlighting performance:
https://github.com/notepad-plus-plus/notepad-plus-plus/commit/de9ffd2ea8507d033f7f111d8b48762f7d3b9436Since it’s for improving the performance & not all the plugins use such notifications, it won’t be reversed. Instead, I will add a new message NPPM_ADDSCINTILLANOTIFS for adding the notifications that plugins can add what they need, just after recieving NPPN_READY
[…]
What do you think?
I think it’s better than just removing functionality, though it could still break existing plugins if their authors are not active and able to keep up with changes. At least it would provide a quick way to restore compatibility when authors are available.
How will this work in connection with NPPN_GLOBALMODIFIED? Will SCN_MODIFIED messages requested by NPPM_ADDSCINTILLANOTIFS still be suppressed during Replace All operations?
Another thought has come to me, but the implications are unpleasant.
Columns++ only uses Scintilla notifications when implementing elastic tabstops, which can be enabled or disabled per document. By default, even after enabling it for one file, it is disabled when loading another file that is over 1000 KB or 5000 lines.
If excluding those notifications really does improve Notepad++ performance for large files, anyone with Columns++ installed would sacrifice that gain, even on files for which they were not using elastic tabstops (which is more likely to be the case with large files) — even those who never use that feature at all. Other plugins might face similar circumstances.
At present, I have no suggestion as to how that could be avoided in practice, though. For my plugin, since the loss of SC_MOD_BEFOREDELETE will cause degradation in responsiveness, rather than outright inaccurate behavior — and there may be another, more complex way to restore the responsiveness — I will have some design considerations to weigh with or without NPPM_ADDSCINTILLANOTIFS.
-
@Coises said in Notepad++ v8.7.6 released:
How will this work in connection with NPPN_GLOBALMODIFIED? Will SCN_MODIFIED messages requested by NPPM_ADDSCINTILLANOTIFS still be suppressed during Replace All operations?
What’s needed is a complelmentary set of
*_GET_*
and*_SET_*
messages like Scintilla has for most properties.Proper usage would be sending the
*_GET_*
message first, masking the return value for the desired flag(s), then restoring the flags by sending the*_SET_*
message with the old value after the plugin is finished modifiying them. -
I recommend that one of the plugin authors involved in this discussion create an issue at this point (referencing this topic, of course): now that the problem is defined, there appears to need to be more technical discussion as to how a fix might be implemented, and that’s better suited to an Issue than the Forum.
(The technical details might dissuade other users from posting other regressions in this discussion, and if the notification-discussion continues after someone does post another regression, their post may get lost in between posts about this issue.)
-
Please test this PR WITH your modified plugins:
https://github.com/notepad-plus-plus/notepad-plus-plus/pull/16120Please let me know if the PR works for you.
-
@Coises said in Notepad++ v8.7.6 released:
though it could still break existing plugins if their authors are not active and able to keep up with changes.
I think it’s not reasonable to stop evolving a project like Notepad++ due to unmaintained plugins.
How will this work in connection with NPPN_GLOBALMODIFIED ? Will SCN_MODIFIED messages requested by NPPM_ADDSCINTILLANOTIFS still be suppressed during Replace All operations?
There’s no connection between NPPM_ADDSCINTILLANOTIFS & NPPN_GLOBALMODIFIED. They work separately.
If excluding those notifications really does improve Notepad++ performance for large files, anyone with Columns++ installed would sacrifice that gain, even on files for which they were not using elastic tabstops (which is more likely to be the case with large files) — even those who never use that feature at all. Other plugins might face similar circumstances.
There are several factors come together to enhance large files’ syntax highlighting performance. Furthermore, it’s about only the performance of switching-in a large file.
So I think it’s OK if one of factors (Scintilla notifications) is turned ON by plugins. The consequence is not significative IMO. -
@PeterJones
A regression issue has been created:
https://github.com/notepad-plus-plus/notepad-plus-plus/issues/16121 -
@donho said in Notepad++ v8.7.6 released:
There are several factors come together to enhance large files’ syntax highlighting performance. Furthermore, it’s about only the performance of switching-in a large file.
So I think it’s OK if one of factors (Scintilla notifications) is turned ON by plugins. The consequence is not significative IMO.At the risk of appearing argumentative… then why disable those events in the first place?
I cannot claim to have completely followed all the discussion behind the change to improve handling in large files, but it looks like the change to the SCN_MODIFIED event mask was based on this:
https://github.com/notepad-plus-plus/notepad-plus-plus/pull/15981#issuecomment-2563388005
I think the improvements to “the performance of switching-in a large file” were connected to turning off all SCN_MODIFIED events during loading. It looks like a note about restoring the environment after loading that said:
Set MODEVENTMASK_ON with SC_MOD_INSERTTEXT | SC_MOD_DELETETEXT only: Adding additional flags generates excessive and unnecessary event messages, degrading performance.
was the basis for changing the default event mask. I suspect this might have been a hasty remark, perhaps not considering that just because these events are unnecessary to Notepad++ itself does not mean that they are unnecessary to plugins. (The example given for overhead that the commenter claims could be skipped by suppressing unnecessary events is for an event, SC_MOD_CHANGEINDICATOR, that is included in the new defaults and won’t be disabled — so apparently it was necessary. In any case, if Notepad++ is doing unnecessary things in response to SCN_MODIFIED events, the sensible thing is to verify that they are unnecessary and remove that code. I suspect there isn’t a lot of code that was added for no reason at all… this logic seems suspect to me.)
I’m questioning whether there is any real evidence that changing which SCN_MODIFIED events are normally enabled (completely separate from temporarily disabling all events during certain activities internal to Notepad++) gains anything. And if anything, enough to warrant the disruption for existing plugins and creation of a new NPPM message?