private void DoEditAction(ICSharpCode.TextEditor.Actions.IEditAction action) { TextEditorControl editor = this.textEditorControl1; if (editor != null && action != null) { TextArea area = editor.ActiveTextAreaControl.TextArea; editor.BeginUpdate(); try { lock (editor.Document) { action.Execute(area); } } finally { editor.EndUpdate(); area.Caret.UpdateCaretPosition(); } } }
private void DoEditAction(ICSharpCode.TextEditor.TextEditorControl editor, ICSharpCode.TextEditor.Actions.IEditAction action) { if (editor != null && action != null) { var area = editor.ActiveTextAreaControl.TextArea; editor.BeginUpdate(); try { lock (editor.Document) { action.Execute(area); if (area.SelectionManager.HasSomethingSelected && area.AutoClearSelection /*&& caretchanged*/) { if (area.Document.TextEditorProperties.DocumentSelectionMode == DocumentSelectionMode.Normal) { area.SelectionManager.ClearSelection(); } } } } finally { editor.EndUpdate(); area.Caret.UpdateCaretPosition(); } } }