-
Notifications
You must be signed in to change notification settings - Fork 29
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Latest Notepad++ 8.2.2 dev builds crash #33
Comments
Same goes for Notepad++ 8.3 x64 |
Yes, 8.2.2 development became 8.3 release. This update allows larger files thus API changes to deal with |
To their credit, the maintainers of NppPlugin.NET have been (slowly) trying to keep up with the evolution of Scintilla's interface: kbilsted/NotepadPlusPlusPluginPack.Net#75 Unfortunately a drop-in replacement won't come fast enough. Here's a quick (untested) patch that might be good enough: diff --git a/CsvQuery/PluginInfrastructure/GatewayDomain.cs b/CsvQuery/PluginInfrastructure/GatewayDomain.cs
index df9cf5b..ecbac0c 100644
--- a/CsvQuery/PluginInfrastructure/GatewayDomain.cs
+++ b/CsvQuery/PluginInfrastructure/GatewayDomain.cs
@@ -175,9 +175,9 @@ namespace CsvQuery.PluginInfrastructure
[StructLayout(LayoutKind.Sequential)]
public struct CharacterRange
{
- public CharacterRange(int cpmin, int cpmax) { cpMin = cpmin; cpMax = cpmax; }
- public int cpMin;
- public int cpMax;
+ public CharacterRange(IntPtr cpmin, IntPtr cpmax) { cpMin = cpmin; cpMax = cpmax; }
+ public IntPtr cpMin;
+ public IntPtr cpMax;
}
public class Cells
@@ -196,18 +196,18 @@ namespace CsvQuery.PluginInfrastructure
IntPtr _ptrSciTextRange;
bool _disposed = false;
- public TextRange(CharacterRange chrRange, int stringCapacity)
+ public TextRange(CharacterRange chrRange, long stringCapacity)
: this(chrRange.cpMin, chrRange.cpMax, stringCapacity)
{ }
- public TextRange(int cpmin, int cpmax, int stringCapacity = 0)
+ public TextRange(IntPtr cpmin, IntPtr cpmax, long stringCapacity = 0)
{
// The capacity must be _at least_ the given range plus one
- stringCapacity = Math.Max(stringCapacity, Math.Abs(cpmax - cpmin) + 1);
+ stringCapacity = Math.Max(stringCapacity, Math.Abs(cpmax.ToInt64() - cpmin.ToInt64()) + 1);
_sciTextRange.chrg.cpMin = cpmin;
_sciTextRange.chrg.cpMax = cpmax;
- _sciTextRange.lpstrText = Marshal.AllocHGlobal(stringCapacity);
+ _sciTextRange.lpstrText = Marshal.AllocHGlobal(new IntPtr(stringCapacity));
}
[StructLayout(LayoutKind.Sequential)]
diff --git a/CsvQuery/PluginInfrastructure/ScintillaGateway.cs b/CsvQuery/PluginInfrastructure/ScintillaGateway.cs
index df169a7..763ce04 100644
--- a/CsvQuery/PluginInfrastructure/ScintillaGateway.cs
+++ b/CsvQuery/PluginInfrastructure/ScintillaGateway.cs
@@ -75,7 +75,7 @@ namespace CsvQuery.PluginInfrastructure
public string GetTextRange(int start, int end)
{
var codepage = GetCodePage();
- using (var tr = new TextRange(start, end))
+ using (var tr = new TextRange(new IntPtr(start), new IntPtr(end)))
{
GetTextRange(tr);
if (codepage == (int) SciMsg.SC_CP_UTF8)
diff --git a/CsvQuery/PluginInfrastructure/Scintilla_iface.cs b/CsvQuery/PluginInfrastructure/Scintilla_iface.cs
index 32e09ab..f012661 100644
--- a/CsvQuery/PluginInfrastructure/Scintilla_iface.cs
+++ b/CsvQuery/PluginInfrastructure/Scintilla_iface.cs
@@ -3010,7 +3010,7 @@ namespace CsvQuery.PluginInfrastructure
/// <param name="cpmin">range to search</param>
/// <param name="cpmax">range to search</param>
/// <param name="searchText">the search pattern</param>
- public TextToFind(int cpmin, int cpmax, string searchText)
+ public TextToFind(IntPtr cpmin, IntPtr cpmax, string searchText)
{
_sciTextToFind.chrg.cpMin = cpmin;
_sciTextToFind.chrg.cpMax = cpmax;
|
Thanks! That seems to work on 8.3 |
I'm not an expert at this, certainly not C#, but I'm not sure that's possible. I tested my updated C++ plugin on version 8.1 and it crashed, but it works fine on 8.3. I think the issue is in changing that Your new version will work for Notepad++ >=8.3. Looking forward to testing CsvQuery! Cheers. |
@vinsworldcom is right.
The Scintilla library that was linked with 8.1 still expects a
Sci_PositonCR to be sizeof(long) on all architectures.
|
I should be able to just check the N++ version and have two data structures - one for legacy and one for 8.3+ |
@jokedst Do you have a test build I can try out for Notepad++ >= 8.3? |
This is still crashing in Notepad++ v8.3.3 (64-bit). |
@wsuhoey @cmbsolutions Cheers. |
Ok ok ok, sorry, been busy. |
Using the latest Notepad 8.2.2 development build and opening the CSV Query window causes Notepad++ to crash. See this thread for info on other plugins that are affected as well.
It may be as simple as recompiling with the latest headers from Notepad++ project:
Cheers.
The text was updated successfully, but these errors were encountered: