Mono.TextEditor.TextEditorData.SearchReplace C# (CSharp) Method

SearchReplace() public method

public SearchReplace ( string withPattern, bool setSelection ) : bool
withPattern string
setSelection bool
return bool
		public bool SearchReplace (string withPattern, bool setSelection)
		{
			bool result = false;
			if (IsSomethingSelected) {
				var selection = MainSelection.GetSelectionRange (this);
				SearchResult match = searchEngine.GetMatchAt (selection.Offset, selection.Length);
				if (match != null) {
					searchEngine.Replace (match, withPattern);
					ClearSelection ();
					Caret.Offset = selection.Offset + withPattern.Length;
					result = true;
				}
			}
			return FindNext (setSelection) != null || result;
		}