private void ReplaceHighlightedText() { TextView view = mManager.ActiveView as TextView; ScintillaControl editControl = view.ScintillaControl; bool useRegex = checkBoxUseRegularExpressions.Checked; if (editControl.GetSelectedText().Length > 0) { editControl.TargetStart = editControl.SelectionStart; editControl.TargetEnd = editControl.SelectionEnd; if (useRegex) { editControl.ReplaceTargetRE(comboBoxReplaceWith.Text); } else { editControl.ReplaceTarget(comboBoxReplaceWith.Text); } editControl.CurrentPos = editControl.TargetEnd + 1; editControl.SelectionStart = editControl.CurrentPos; editControl.SelectionEnd = editControl.CurrentPos; } }