NotepadPlusPlusPluginPack.Net icon indicating copy to clipboard operation
NotepadPlusPlusPluginPack.Net copied to clipboard

ScNotification.TextPointer points to nothing in 64bit

Open Roy192 opened this issue 4 years ago • 1 comments
trafficstars

I tried using the SCN_AUTOCSELECTION notification to insert something else than what was selected in the autocomplete menu.

The pointer to the text of the selected option should be in notification.TextPointer. But when run in 64bit, it points to nothing, and notification.Length contains some large negative number.

image

The problem seems to be that the type of position that appears ahead of TextPointer in the ScNotification struct is of the wrong type.

In the plugin template it's an int, while in the sourcecode of scintilla it's defined as a Sci_Position which is a ptrdiff_t. image

So I think that needs to change from int to IntPtr (and if I try and test that, it does seem to work for both 32 and 64 bit).

There seems to be a few more fields (mentioned by dinkumoil in the topic linked below) that have changed from int to ptrdiff_t, so you'll probably need to change more than just position: https://community.notepad-plus-plus.org/topic/17755/notepad-7-7-breaking-change-of-scnotification-definition-in-x64-build

Here is a small project to demonstrate the issue (run it, use the Plugins > MyNppPluginAutoC > MyMenuCommand, an autocomplete menu should appear, select something, and a messagebox should show what was selected, then try again in 64bit): MyNppPluginAutoC.zip

Roy192 avatar May 13 '21 14:05 Roy192

@roy192 , completely understandable. seems like bug that was missed when producing the template files. will try to correct them in free time.

mahee96 avatar May 23 '21 13:05 mahee96

Fixed.

Closing issue.

mahee96 avatar Nov 17 '22 20:11 mahee96