// Use the dialog configuration to search for all matches.
        private List <CharacterRange> FindAllWrapper()
        {
            var results = _manager.FindAll(GetQuery(), chkMarkLine.Checked, chkHighlightMatches.Checked);

            FindAllResults?.Invoke(this, new FindResultsEventArgs(_manager, results));
            return(results);
        }
예제 #2
0
        public List <CharacterRange> FindAll(CharacterRange rangeToSearch, Regex findExpression, bool mark, bool highlight)
        {
            var results = new List <CharacterRange>();

            Scintilla.IndicatorCurrent = Indicator.Index;

            var findCount = 0;
            var lastLine  = -1;

            while (true)
            {
                var r = Find(rangeToSearch, findExpression);
                if (r.MinPosition == r.MaxPosition)
                {
                    break;
                }

                results.Add(r);
                findCount++;
                if (mark)
                {
                    //	We can of course have multiple instances of a find on a single
                    //	line. We don't want to mark this line more than once.
                    var line = new Line(Scintilla, Scintilla.LineFromPosition(r.MinPosition));
                    if (line.Position > lastLine)
                    {
                        line.MarkerAdd(Marker.Index);
                    }
                    lastLine = line.Position;
                }
                if (highlight)
                {
                    Scintilla.IndicatorFillRange(r.MinPosition, r.MaxPosition - r.MinPosition);
                }
                rangeToSearch = new CharacterRange(r.MaxPosition, rangeToSearch.MaxPosition);
            }

            FindAllResults?.Invoke(this, new ResultsEventArgs(new FindResults(results)));

            return(results);
        }