public static void SelectEndOfWrappedLine(EditorViewController controller) { SelectAction(controller, EndOfWrappedLine); }
public static void SelectLeftWord(EditorViewController controller) { SelectAction(controller, LeftWord); }
public static void SelectEndOfBuffer(EditorViewController controller) { SelectAction(controller, EndOfBuffer); }
public static void SelectDown(EditorViewController controller) { SelectAction(controller, Down); }
public static void SelectBeginningOfWrappedLine( EditorViewController controller) { SelectAction(controller, BeginningOfWrappedLine); }
public static void SelectBeginningOfBuffer(EditorViewController controller) { SelectAction(controller, BeginningOfBuffer); }
protected override void Do( object context, CommandFactoryManager <OperationContext> commandFactory, object commandData, OperationContext operationContext, EditorViewController controller, IDisplayContext displayContext, TextPosition position) { // Get the text from the clipboard. Clipboard clipboard = displayContext.Clipboard; clipboard.RequestText(null); string clipboardText = clipboard.WaitForText(); if (string.IsNullOrEmpty(clipboardText)) { return; } // Figure out the position of this paste. TextPosition textPosition; if (displayContext.Caret.Selection.IsEmpty) { textPosition = new TextPosition( displayContext.Caret.Position.LinePosition, displayContext.Caret.Position.CharacterPosition); } else { textPosition = displayContext.Caret.Selection.FirstTextPosition; } // Create the paste command for the text. CompositeCommand <OperationContext> command = new PasteCommand <OperationContext>( controller.CommandController, textPosition, clipboardText); // If we have a selection, we need to delete the selection first. if (!displayContext.Caret.Selection.IsEmpty) { // Create the composite command for the delete. var composite = new CompositeCommand <OperationContext>(true, false); IUndoableCommand <OperationContext> selection = DeleteSelectionCommandFactory.CreateCommand(controller, displayContext); composite.Commands.Add(selection); composite.Commands.Add(command); // Move the composite over to the command. command = composite; } // Execute the command. controller.CommandController.Do(command, operationContext); // If we have a text position, we need to set it. if (operationContext.Results.HasValue) { displayContext.Caret.SetAndScrollToPosition( operationContext.Results.Value.TextPosition); } }