public override void Execute(TextCompletionEngine textCompletionEngine, TextArea textArea)
        {
            textArea.GetSelectionBounds(out int startLine, out int endLine);
            int startOffset = textArea.Document.GetOffset(startLine, 0);

            textArea.Document.UndoStack.StartUndoGroup();
            try
            {
                for (int i = startLine; i <= endLine; i++)
                {
                    ICSharpCode.AvalonEdit.Document.DocumentLine line = textArea.Document.GetLineByNumber(i);
                    string lineText = textArea.Document.GetText(line.Offset, line.Length);
                    if (lineText.StartsWith(Prefix))
                    {
                        textArea.Document.Remove(line.Offset, Prefix.Length);
                    }
                }

                ICSharpCode.AvalonEdit.Document.DocumentLine endDocumentLine = textArea.Document.GetLineByNumber(endLine);
                textArea.Selection = Selection.Create(textArea, startOffset, endDocumentLine.EndOffset);
            }
            finally
            {
                textArea.Document.UndoStack.EndUndoGroup();
            }
        }
Beispiel #2
0
 public virtual void Execute(TextCompletionEngine textCompletionEngine, TextArea textArea)
 {
 }
Beispiel #3
0
 public void ExecuteCommand(TextArea textArea, TextCompletionEngine textCompletionEngine)
 {
     Command.Execute(textCompletionEngine, textArea);
 }
 public override void Execute(TextCompletionEngine textCompletionEngine, TextArea textArea)
 {
     textCompletionEngine.CompleteCode();
 }