private void findNext()
        {
            if (txtFind.Text == string.Empty)
            {
                return;
            }
            if (_scintilla == null)
            {
                return;
            }

            ScintillaNET_FindReplaceDialog.CharacterRange r = _findReplace.FindNext(txtFind.Text, true, _findReplace.Window.GetSearchFlags());
            if (r.cpMin != r.cpMax)
            {
                _scintilla.SetSel(r.cpMin, r.cpMax);
            }

            MoveFormAwayFromSelection();
        }
Example #2
0
        private CharacterRange FindNextR(bool searchUp, ref Regex rr)
        {
            CharacterRange foundRange;

            if (rdoRegexR.Checked)
            {
                if (rr == null)
                {
                    rr = new Regex(txtFindR.Text, GetRegexOptions());
                }

                if (chkSearchSelectionR.Checked)
                {
                    if (_searchRange.cpMin == _searchRange.cpMax)
                    {
                        _searchRange = new CharacterRange(_scintilla.Selections[0].Start, _scintilla.Selections[0].End);
                    }

                    if (searchUp)
                    {
                        foundRange = FindReplace.FindPrevious(rr, chkWrapR.Checked, _searchRange);
                    }
                    else
                    {
                        foundRange = FindReplace.FindNext(rr, chkWrapR.Checked, _searchRange);
                    }
                }
                else
                {
                    _searchRange = new CharacterRange();
                    if (searchUp)
                    {
                        foundRange = FindReplace.FindPrevious(rr, chkWrapR.Checked);
                    }
                    else
                    {
                        foundRange = FindReplace.FindNext(rr, chkWrapR.Checked);
                    }
                }
            }
            else
            {
                if (chkSearchSelectionF.Checked)
                {
                    if (_searchRange.cpMin == _searchRange.cpMax)
                    {
                        _searchRange = new CharacterRange(_scintilla.Selections[0].Start, _scintilla.Selections[0].End);
                    }

                    if (searchUp)
                    {
                        string textToFind = rdoExtendedR.Checked ? FindReplace.Transform(txtFindR.Text) : txtFindR.Text;
                        foundRange = FindReplace.FindPrevious(textToFind, chkWrapR.Checked, GetSearchFlags(), _searchRange);
                    }
                    else
                    {
                        string textToFind = rdoExtendedR.Checked ? FindReplace.Transform(txtFindR.Text) : txtFindR.Text;
                        foundRange = FindReplace.FindNext(textToFind, chkWrapR.Checked, GetSearchFlags(), _searchRange);
                    }
                }
                else
                {
                    _searchRange = new CharacterRange();
                    if (searchUp)
                    {
                        string textToFind = rdoExtendedR.Checked ? FindReplace.Transform(txtFindR.Text) : txtFindR.Text;
                        foundRange = FindReplace.FindPrevious(textToFind, chkWrapF.Checked, GetSearchFlags());
                    }
                    else
                    {
                        string textToFind = rdoExtendedR.Checked ? FindReplace.Transform(txtFindR.Text) : txtFindR.Text;
                        foundRange = FindReplace.FindNext(textToFind, chkWrapF.Checked, GetSearchFlags());
                    }
                }
            }
            return(foundRange);
        }