Skip to content
This repository has been archived by the owner on Jan 13, 2024. It is now read-only.

ScNotification.TextPointer points to nothing in 64bit #68

Closed
ghost opened this issue May 13, 2021 · 2 comments
Closed

ScNotification.TextPointer points to nothing in 64bit #68

ghost opened this issue May 13, 2021 · 2 comments

Comments

@ghost
Copy link

ghost commented May 13, 2021

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

@mahee96
Copy link
Collaborator

mahee96 commented May 23, 2021

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

@mahee96
Copy link
Collaborator

mahee96 commented Nov 17, 2022

Fixed.

Closing issue.

@mahee96 mahee96 closed this as completed Nov 17, 2022
@mahee96 mahee96 unpinned this issue Nov 17, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant