Skip to content

Commit 947a723

Browse files
committed
- Added code comments
1 parent 62ff867 commit 947a723

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

src/CSScriptIntellisense/Interop/NppExtensions.cs

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -425,11 +425,18 @@ static public int[] GetNppVersion(out bool newVersioning)
425425
// Starting from 8.4.1 new API is available for getting the version with LOWORD always returning 3 digits
426426
// if new messages is not supported so use the old one
427427

428-
// !!! This mechanism is not reliable. NPPM_GETNPPVERSION_NEW may return different
429-
// result (0x0000000000000000 vs 0x000000000000000a) depending if it was started normally or restarted due
430-
// to the "need to be admin to save"
431-
432-
const uint NPPM_GETNPPVERSION_NEW = (uint)(NppMsg.NPPMSG + 109);
428+
// ironically NPP vendor defended the decision to introduce NPPM_GETNPPVERSION_NEW=NPPMSG+109
429+
// here: https://github.com/notepad-plus-plus/notepad-plus-plus/issues/11535#issuecomment-1120080549
430+
// This was the base for implementing this method.
431+
// And yet eventually Don Ho has changed his opinion and now (as of 22/01/2023) it is back to old
432+
// value NPPM_GETNPPVERSION_NEW=NPPMSG+50 (equivalent of the old NPPM_GETNPPVERSION)
433+
// This in turn yields to failure to detect the compatible NPP version and Triggering the use of invalid
434+
// send-message params when getting the text range from scintilla.
435+
// NPP in turn dose not handle the errors and crashes. Brilliant!!! Everyone blames the plugin, even though
436+
// it is a clear mismanagement of the host API.
437+
438+
// const uint NPPM_GETNPPVERSION_NEW = (uint)(NppMsg.NPPMSG + 109);
439+
const uint NPPM_GETNPPVERSION_NEW = (uint)(NppMsg.NPPMSG + 50);
433440

434441
IntPtr version = Win32.SendMessage(Npp.Editor.Handle, NPPM_GETNPPVERSION_NEW, 0, 0);
435442

0 commit comments

Comments
 (0)