Example #1
0
        private unsafe SearchResult InternalSearch(SearchFlags flags, string text, int startPosition, int endPosition)
        {
            fixed (byte* pt = Encoding.UTF8.GetBytes(text))
            {
                var pf = new TextToFind();
                pf.lpstrText = (IntPtr)pt;
                pf.chrg.Min = startPosition;
                pf.chrg.Max = endPosition <= 0 ? startPosition + scintilla.Ref.Send(Sci.SCI_GETTEXTLENGTH) : endPosition;

                var res = RunSearch(flags, ref pf);

                if (res == -1)
                    return SearchResult.NotFound;
                else
                    return new SearchResult(pf.chrgText.Min, pf.chrgText.Max);
            }
        }
Example #2
0
 private unsafe int RunSearch(SearchFlags flags, ref TextToFind ttf)
 {
     fixed (TextToFind* pff = &ttf)
         return scintilla.Ref.Send(Sci.SCI_FINDTEXT, (Int32)flags, (IntPtr)pff);
 }