Default implementation of the ICSharpCode.TextEditor.Document.ISelection interface.
Inheritance: ISelection
 public static ascx_SourceCodeEditor setSelectionText(this ascx_SourceCodeEditor codeEditor, Location startLocation, Location endLocation)
 {
     return((ascx_SourceCodeEditor)codeEditor.invokeOnThread(() =>
     {
         var start = new ICSharpCode.TextEditor.TextLocation(startLocation.X - 1, startLocation.Y - 1);
         var end = new ICSharpCode.TextEditor.TextLocation(endLocation.X - 1, endLocation.Y - 1);
         var selection = new ICSharpCode.TextEditor.Document.DefaultSelection(codeEditor.document(), start, end);
         codeEditor.textArea().SelectionManager.SetSelection(selection);
         codeEditor.caret_Line(start.Line);
         codeEditor.caret_Column(start.Column);
         return codeEditor;
     }));
 }
		void HighlightText(int offset, int length)
		{
			int endOffset = offset + length;
			TextArea.Caret.Position = TextArea.Document.OffsetToPosition(endOffset);
			TextArea.SelectionManager.ClearSelection();
			IDocument document = TextArea.Document;
			DefaultSelection selection = new DefaultSelection(document, document.OffsetToPosition(offset), document.OffsetToPosition(endOffset));
			TextArea.SelectionManager.SetSelection(selection);
			textEditor.Refresh();
		}
 public static SourceCodeEditor setSelectionText(this SourceCodeEditor codeEditor, Location startLocation, Location endLocation)
 {
     return codeEditor.invokeOnThread(
         () =>{
                  var start = new TextLocation(startLocation.X - 1, startLocation.Y - 1);
                  var end = new TextLocation(endLocation.X - 1, endLocation.Y - 1);
                  var selection = new DefaultSelection(codeEditor.document(), start, end);
                  codeEditor.textArea().SelectionManager.SetSelection(selection);
                  codeEditor.caret_Line(start.Line);
                  codeEditor.caret_Column(start.Column);
                  return codeEditor;
         });
 }
 public static SourceCodeEditor selectTextWithColor(this SourceCodeEditor codeEditor, DefaultSelection selection, TextMarkerType textMarkerType, Color color)
 {
     if (selection.Length < 0)
     {
         "in SourceCodeEditor.selectTextWithColor selection.Length was <  0".error();
         return codeEditor;
     }
     return codeEditor.invokeOnThread(
         ()=>{
                 var newMarker = new TextMarker(
                     selection.Offset,
                     selection.Length,
                     textMarkerType, color);
                 codeEditor.document().MarkerStrategy.AddMarker(newMarker);
                 return codeEditor;
         });
 }
 public static SourceCodeEditor selectTextWithColor(this SourceCodeEditor codeEditor, DefaultSelection selection)
 {
     return codeEditor.selectTextWithColor(selection, TextMarkerType.SolidBlock, Color.LightBlue);
 }
        public static TextEditorControl showAstValueInSourceCode(this TextEditorControl textEditorControl, AstValue<object> astValue)
        {
            return (TextEditorControl)textEditorControl.invokeOnThread(() =>
                {
                    PublicDI.log.error("{0} {1} - {2}", astValue.Text, astValue.StartLocation, astValue.EndLocation);

                    var start = new TextLocation(astValue.StartLocation.X - 1,
                                                                        astValue.StartLocation.Y - 1);
                    var end = new TextLocation(astValue.EndLocation.X - 1, astValue.EndLocation.Y - 1);
                    var selection = new DefaultSelection(textEditorControl.Document, start, end);
                    textEditorControl.ActiveTextAreaControl.SelectionManager.SetSelection(selection);
                    setCaretToCurrentSelection(textEditorControl);
                    return textEditorControl;
                });
        }
 public static ascx_SourceCodeEditor selectTextWithColor(this ascx_SourceCodeEditor codeEditor, DefaultSelection selection, TextMarkerType textMarkerType, Color color)
 {
     if (selection.Length < 0)
     {
         "in ascx_SourceCodeEditor.selectTextWithColor selection.Length was <  0".error();
         return codeEditor;
     }
     //"offset: {0} : lenght {1}".format(selection.Offset, selection.Length).info();
     return (ascx_SourceCodeEditor)codeEditor.invokeOnThread(
     () =>
     {
         //"offset: {0} : lenght {1}".format(selection.Offset, selection.Length).info();
         var newMarker = new TextMarker(
                                 selection.Offset,
                                 selection.Length,
                                 textMarkerType, color);
         codeEditor.document().MarkerStrategy.AddMarker(newMarker);
         return codeEditor;
     });
 }