Closed megakraken closed 3 months ago
Thankyou @megakraken,
No, it's not how it's supposed to work. Unfortunately, some Notepad++ internal changes interfere with the plugin's business logic. It might be happening again as I have updated N++ and started having the same problem.
Thank you for reporting. I will have a look at it.
Upd: it looks like now N++ is stealing the focus from the plugin popup so it does not receive the keystrokes so filtering is not triggered.
Will see how it can be worked around.
The things are happen to be more complicated. While the loss of input focus indeed prevents keystrokes from going to the plugin it is actually Scintilla who is a suspect here (or NPP/Scintilla interop).
For whatever reason the SciMsg.SCN_CHARADDED
notifications are coming with the char pointer set to zero.
Fortunately, it's possible to find out what character was typed by other means but.... it is not very elegant.
Though the user experience will remain the same. I will publish the update in a day or two.
Done fix is available in the latest release v2.0.4.0 (Releases page) The release has also been published on nppPluginList but the next release of the plugins updates up to the N++ team.
If you do not want to wait for the next N++ release, you can update the plugin from the Plugin-settings page. The release source is:
@oleg-shilo
While the loss of input focus indeed prevents keystrokes from going to the plugin it is actually Scintilla who is a suspect here (or NPP/Scintilla interop).
For whatever reason the
SciMsg.SCN_CHARADDED
notifications are coming with the char pointer set to zero.
Just a quick postscript here. The underlying issue really is NPP/Scintilla interop. Specifically, the .NET wrapper for notifications has wrongly sized fields for 64-bit binary compatibility.
In a 64-bit process, the editor fills nc.position
with 64 bits of data (because the C++ member type, Sci_Position
, is pointer-width). But the .NET member type is int
, which only holds 32 bits. The spillover data clobbers the field beside it (nc.character
), and so on, clobbering all the neighbouring memory blocks in turn. You should not trust any of those fields to have sensible values in 64-bit mode.
I would not worry about it now since the reported bug is fixed well enough.
If memory safety issues come up in the future, have a look at this related issue, and the quick patch that resolved it.
@rdipardo, thank you so much for a detailed explanation. It makes perfect sense.
I will update the struct ScNotification
as you suggested.
It's great to have you in this conversation. It's not the first time you have assisted me with the intricacies of the Scintilla interface. Greatly appreciated.
It makes perfect sense.
If only the people who made Plugin.NET so popular had thought so, too 😔. Somebody had the bright idea of making plugins "easy" to develop. The ironic truth is there's nothing easy about safely marshalling .NET objects into C-like structures. By now there must be thousands and thousands of .NET plugins on end-user PCs, all of them silently writing data out of bounds every time Scintilla emits a notification...
Hello,
when typing something like
File.
I would expect the intellisense popup to appear with all members forFile
and then as I proceed to type see the list gradually be narrowed down to the matching members. Well, just like in Visual Studio.However the popup won't appear automatically after typing
.
and the only way I can get it to show is by pressing CTRL + Space. Also the list won't narrow down as I continue typing and I have to manually scroll through it to select the member I want.Here's a video that illustrates what I mean:
https://github.com/oleg-shilo/cs-script.npp/assets/15066925/a07438f3-e29b-45ba-821a-32f813d9fba0
Is this how this plugin is supposed to work or is there something wrong? I didn't change any of the settings and it's a fresh install of notepad++ without any other plugins running.
For what it's worth I'm using plugin version
1.7.24.0 (x64)
and notepad++ versionv8 (x64)
as suggested in #71 because I'm wanting to target the .NET Framework.Thanks for any help!