public virtual void FindNext(string pattern) { try { RegexOptions opt = materialCheckBox1.Checked ? RegexOptions.None : RegexOptions.IgnoreCase; if (!materialCheckBox1.Checked) { pattern = Regex.Escape(pattern); } if (materialCheckBox1.Checked) { pattern = "\\b" + pattern + "\\b"; } // Range range = editor.Selection.Clone(); range.Normalize(); // if (firstSearch) { startPlace = range.Start; firstSearch = false; } // range.Start = range.End; if (range.Start >= startPlace) { range.End = new Place(editor.GetLineLength(editor.LinesCount - 1), editor.LinesCount - 1); } else { range.End = startPlace; } // foreach (var r in range.GetRangesByLines(pattern, opt)) { editor.Selection = r; editor.DoSelectionVisible(); editor.Invalidate(); return; } // if (range.Start >= startPlace && startPlace > Place.Empty) { editor.Selection.Start = new Place(0, 0); FindNext(pattern); return; } MessageBox.Show("Not found"); } catch (Exception ex) { MessageBox.Show(ex.Message); } }