kbilsted / NotepadPlusPlusPluginPack.Net

.Net package to install into visual studio to make plugins for Notepad++
Apache License 2.0
165 stars 52 forks source link

bug: Some ScNotification fields are the wrong size #110

Closed molsonkiko closed 1 year ago

molsonkiko commented 1 year ago

Specifically, position, Length, LinesAdded, and LineNumber should all have type IntPtr, not int.

More generally, every place in the plugin where the Scintilla documentation says Sci_Position should be IntPtr, not int. I don't feel like going through the rest of the plugin to look for other mistakes, but I can submit a PR to fix this specific issue.

I ran into this problem when I was trying to get the ModificationType of a notification, and it worked correctly in x86, but not in x64. Since ModificationType comes after some of the wrong-size fields, it was misaligned until I fixed this bug.

I should also mention that the IdFrom field of the ScNotificationHeader struct should probably technically be a UIntPtr, but AFAIK it doesn't matter at all, so I'm going to choose to believe that it's fine.

molsonkiko commented 1 year ago

OH NVM, looks like this is fine, it was already solved in a more recent version of the pluginpack