Esempio n. 1
0
        public unsafe Range Find(int startPos, int endPos, string searchString, SearchFlags flags)
        {
            TextToFind ttf = new TextToFind();

            ttf.chrg.cpMin = startPos;
            ttf.chrg.cpMax = endPos;

            fixed(byte *pb = Scintilla.Encoding.GetBytes(searchString))
            {
                ttf.lpstrText = (IntPtr)pb;
                int pos = NativeScintilla.FindText((int)flags, ref ttf);

                if (pos >= 0)
                {
                    return(new Range(pos, pos + searchString.Length, Scintilla));
                }
                else
                {
                    return(null);
                }
            }
        }
Esempio n. 2
0
		public unsafe Range Find(int startPos, int endPos, string searchString, SearchFlags flags)
		{
			TextToFind ttf = new TextToFind();
			ttf.chrg.cpMin = startPos;
			ttf.chrg.cpMax = endPos;

			fixed (byte* pb = Scintilla.Encoding.GetBytes(searchString))
			{
				ttf.lpstrText = (IntPtr)pb;
				int pos = NativeScintilla.FindText((int)flags, ref ttf);
				if (pos >= 0)
				{
					return new Range(pos, pos + searchString.Length, Scintilla);
				}
				else
				{
					return null;
				}
			}
		}
		unsafe int INativeScintilla.FindText(int searchFlags, ref TextToFind ttf)
		{
			//	{wi17869} 2008-08-15 Chris Rickard
			//	searchFlags weren't getting sent to SendMessageDirect. IntPtr.Zero was.
			//	This has been fixed
			fixed(TextToFind* ttfp = &ttf)
				return (int)_ns.SendMessageDirect(Constants.SCI_FINDTEXT, (IntPtr)searchFlags, (IntPtr)ttfp);
		}