void RemoveSelectionMarker() { if (selectionMarker == null) { return; } this.textEditor.Document.RemoveMarker(selectionMarker); selectionMarker = null; }
private void Find(object sender, CancelEventArgs arg) { if (prm.Filter != null && prm.Filter.Length > 1 && prm.Filter.Trim().Length > 0) { int flen = prm.Filter.Length; int len = editor.TextArea.Document.LineCount; for (int i = 0; i < len; i++) { var segment = editor.TextArea.Document.GetLine(i); var ch = editor.TextArea.Document.GetText(segment); int find = 0; while (find < segment.Length) { if (arg.Cancel) { return; } if (!prm.CaseSensitive) { find = ch.IndexOf(prm.Filter, find, StringComparison.OrdinalIgnoreCase); } else { find = ch.IndexOf(prm.Filter, find, StringComparison.Ordinal); } if (find >= 0) { var marker = new TextSegmentMarker(segment.Offset + find, flen); editor.TextArea.Document.AddMarker(marker); list.Add(marker); find = find + flen; } else { break; } } } } }