I have a scenario, where I would like to delete some text.
I select desired string with TargetStart and TargetEnd.
I perform a successful SearchInTarget
I call the method ReplaceTarget("")
An assert is called from SCI_REPLACETARGET in SciLexer 3.7.2\src\Editor.cxx, because of PLATFORM_ASSERT(lParam);
The reason is because text is empty in public unsafe int ReplaceTarget(string text) and it translates to bytes and IntPtr of null.
public unsafe int ReplaceTarget(string text)
{
if (text == null)
text = string.Empty;
var bytes = Helpers.GetBytes(text, Encoding, false);
fixed (byte* bp = bytes)
DirectMessage(NativeMethods.SCI_REPLACETARGET, new IntPtr(bytes.Length), new IntPtr(bp));
return text.Length;
}
Here the Editor.cxx
case SCI_REPLACETARGET:
PLATFORM_ASSERT(lParam);
return ReplaceTarget(false, CharPtrFromSPtr(lParam), static_cast<int>(wParam));
The assertion influences only the debug modus. Everything is fine in release.
Greetings
Filip Rychnavský
I have a scenario, where I would like to delete some text.
TargetStart
andTargetEnd
.SearchInTarget
I call the method ReplaceTarget("") An assert is called from
SCI_REPLACETARGET
in SciLexer 3.7.2\src\Editor.cxx, because of PLATFORM_ASSERT(lParam); The reason is becausetext
is empty inpublic unsafe int ReplaceTarget(string text)
and it translates tobytes
andIntPtr
ofnull
.Here the Editor.cxx
The assertion influences only the debug modus. Everything is fine in release. Greetings Filip Rychnavský