public override void MoveToEndOfViewLine(bool extendSelection) { VirtualSnapshotPoint oldCaretPoint = this.AdvancedCaret.Position.VirtualBufferPosition; SnapshotPoint selectionEnd = this.TextView.Selection.AdvancedSelection.End.Position; bool selectionIsEmpty = TextView.Selection.IsEmpty; if (!extendSelection) { TextView.AdvancedTextView.Selection.Clear(); } if (!selectionIsEmpty && !extendSelection) { var selectionEndLine = this.TextView.AdvancedTextView.GetTextViewLineContainingBufferPosition(selectionEnd); AdvancedCaret.MoveTo(selectionEndLine.End, PositionAffinity.Predecessor); } else { ITextViewLine line = this.AdvancedCaret.ContainingTextViewLine; AdvancedCaret.MoveTo(line.End, line.IsLastTextViewLineForSnapshotLine ? PositionAffinity.Successor : PositionAffinity.Predecessor); } AdvancedCaret.EnsureVisible(); UpdateSelection(extendSelection, oldCaretPoint); }
public override void MoveToNextCharacter(bool extendSelection) { VirtualSnapshotPoint oldCaretPoint = this.AdvancedCaret.Position.VirtualBufferPosition; TextPoint endPoint = TextView.Selection.GetEndPoint(); bool selectionIsEmpty = TextView.Selection.IsEmpty; if (!extendSelection) { TextView.AdvancedTextView.Selection.Clear(); } // If the selection is not empty, VS clears the selection and sets // the caret at the end of the selection (regardless of it were reversed or not) if (!extendSelection && !selectionIsEmpty) { MoveTo(endPoint.CurrentPosition); } else { AdvancedCaret.MoveToNextCaretPosition(); } AdvancedCaret.EnsureVisible(); UpdateSelection(extendSelection, oldCaretPoint); }
public override bool DeletePrevious() { if (TextView.Selection.IsEmpty) { if (AdvancedCaret.InVirtualSpace) { AdvancedCaret.MoveToPreviousCaretPosition(); } else { if (!CaretPoint.DeletePrevious()) { return(false); } if (AdvancedCaret.InVirtualSpace) { AdvancedCaret.MoveTo(AdvancedCaret.Position.BufferPosition); } } } else { if (!TextView.Selection.Delete()) { return(false); } } AdvancedCaret.EnsureVisible(); return(true); }
public override void MoveToLine(int lineNumber) { DisplayTextPoint caretLocation = CaretPoint; TextView.Selection.Clear(); caretLocation.MoveToLine(lineNumber); AdvancedCaret.MoveTo(caretLocation.AdvancedTextPoint); AdvancedCaret.EnsureVisible(); }
public override bool InsertIndent() { if (!CaretPoint.InsertIndent()) { return(false); } AdvancedCaret.EnsureVisible(); return(true); }
public override bool RemovePreviousIndent() { if (!CaretPoint.RemovePreviousIndent()) { return(false); } AdvancedCaret.EnsureVisible(); return(true); }
public override bool TransposeCharacter() { if (!CaretPoint.TransposeCharacter()) { return(false); } TextView.Selection.Clear(); AdvancedCaret.EnsureVisible(); return(true); }
public override void MoveToStartOfDocument(bool extendSelection) { VirtualSnapshotPoint oldCaretPoint = this.AdvancedCaret.Position.VirtualBufferPosition; if (!extendSelection) { TextView.AdvancedTextView.Selection.Clear(); } AdvancedCaret.MoveTo(new SnapshotPoint(TextView.AdvancedTextView.TextSnapshot, 0)); AdvancedCaret.EnsureVisible(); UpdateSelection(extendSelection, oldCaretPoint); }
public override void MoveTo(int position, bool extendSelection) { VirtualSnapshotPoint oldCaretPoint = this.AdvancedCaret.Position.VirtualBufferPosition; SnapshotPoint bufferPosition = new SnapshotPoint(TextView.AdvancedTextView.TextSnapshot, position); if (!extendSelection) { TextView.AdvancedTextView.Selection.Clear(); } AdvancedCaret.MoveTo(bufferPosition); AdvancedCaret.EnsureVisible(); this.UpdateSelection(extendSelection, oldCaretPoint); }
public override void MoveToPreviousWord(bool extendSelection) { VirtualSnapshotPoint oldCaretPoint = this.AdvancedCaret.Position.VirtualBufferPosition; DisplayTextPoint caretLocation = CaretPoint; if (!extendSelection) { TextView.AdvancedTextView.Selection.Clear(); } caretLocation.MoveToPreviousWord(); AdvancedCaret.MoveTo(caretLocation.AdvancedTextPoint); AdvancedCaret.EnsureVisible(); UpdateSelection(extendSelection, oldCaretPoint); }
public override bool TransposeLine(int lineNumber) { if (!TextView.Selection.IsEmpty) { return(true); } if (!CaretPoint.TransposeLine(lineNumber)) { return(false); } AdvancedCaret.EnsureVisible(); return(true); }
public override void MoveToLine(int lineNumber, int offset, bool extendSelection) { VirtualSnapshotPoint oldCaretPoint = this.AdvancedCaret.Position.VirtualBufferPosition; if (!extendSelection) { TextView.AdvancedTextView.Selection.Clear(); } ITextSnapshotLine line = TextView.AdvancedTextView.TextSnapshot.GetLineFromLineNumber(lineNumber); AdvancedCaret.MoveTo(new VirtualSnapshotPoint(line, offset)); AdvancedCaret.EnsureVisible(); UpdateSelection(extendSelection, oldCaretPoint); }
public override bool InsertText(string text) { if (!TextView.Selection.IsEmpty) { if (!TextView.Selection.Delete()) { return(false); } } if (!CaretPoint.InsertText(text)) { return(false); } AdvancedCaret.EnsureVisible(); return(true); }
public override bool TransposeLine() { if (TextView.Selection.IsEmpty) { TextPoint caretPoint = CaretPoint; double oldLeft = AdvancedCaret.Left; if (!caretPoint.TransposeLine()) { return(false); } AdvancedCaret.MoveTo(caretPoint.AdvancedTextPoint, PositionAffinity.Successor, false); AdvancedCaret.EnsureVisible(); ITextViewLine newLine = AdvancedTextViewLine; AdvancedCaret.MoveTo(newLine, oldLeft); AdvancedCaret.EnsureVisible(); } return(true); }
public override bool DeleteNext() { if (TextView.Selection.IsEmpty) { if (!CaretPoint.DeleteNext()) { return(false); } } else { if (!TextView.Selection.Delete()) { return(false); } } AdvancedCaret.EnsureVisible(); return(true); }
public override void MoveToPreviousCharacter(bool extendSelection) { VirtualSnapshotPoint oldCaretPoint = this.AdvancedCaret.Position.VirtualBufferPosition; TextPoint startPoint = TextView.Selection.GetStartPoint(); bool selectionIsEmpty = TextView.Selection.IsEmpty; if (!extendSelection) { TextView.AdvancedTextView.Selection.Clear(); } if (!extendSelection && !selectionIsEmpty) { MoveTo(startPoint.CurrentPosition); } else { AdvancedCaret.MoveToPreviousCaretPosition(); } AdvancedCaret.EnsureVisible(); UpdateSelection(extendSelection, oldCaretPoint); }
public override void EnsureVisible() { AdvancedCaret.EnsureVisible(); }