Skip to content

Commit

Permalink
Npp 8.3 Works (but not 8.2)
Browse files Browse the repository at this point in the history
  • Loading branch information
Joakim Wennergren committed Feb 18, 2022
1 parent d6cb77b commit b2de6f1
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
14 changes: 7 additions & 7 deletions CsvQuery/PluginInfrastructure/GatewayDomain.cs
Original file line number Diff line number Diff line change
Expand Up @@ -175,9 +175,9 @@ public KeyModifier(SciMsg SCK_KeyCode, SciMsg SCMOD_modifier)
[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
Expand All @@ -196,18 +196,18 @@ public class TextRange : IDisposable
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)]
Expand Down
2 changes: 1 addition & 1 deletion CsvQuery/PluginInfrastructure/ScintillaGateway.cs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public int GetCurrentLineNumber()
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)
Expand Down
2 changes: 1 addition & 1 deletion CsvQuery/PluginInfrastructure/Scintilla_iface.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3010,7 +3010,7 @@ public TextToFind(CharacterRange chrRange, string searchText)
/// <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;
Expand Down

0 comments on commit b2de6f1

Please sign in to comment.