Exemplo n.º 1
0
 /// <inheritdoc/>
 public override Selection UpdateOnDocumentChange(DocumentChangeEventArgs e)
 {
     if (e == null)
         throw new ArgumentNullException("e");
     return Selection.Create(
         textArea,
         new TextViewPosition(textArea.Document.GetLocation(e.GetNewOffset(startOffset, AnchorMovementType.Default)), start.VisualColumn),
         new TextViewPosition(textArea.Document.GetLocation(e.GetNewOffset(endOffset, AnchorMovementType.Default)), end.VisualColumn)
     );
 }
Exemplo n.º 2
0
 internal void OnDocumentChanged(DocumentChangeEventArgs e)
 {
     InvalidateVisualColumn();
     if (storedCaretOffset >= 0) {
         int newCaretOffset = e.GetNewOffset(storedCaretOffset, AnchorMovementType.Default);
         TextDocument document = textArea.Document;
         if (document != null) {
             // keep visual column
             this.Position = new TextViewPosition(document.GetLocation(newCaretOffset), position.VisualColumn);
         }
     }
     storedCaretOffset = -1;
 }
Exemplo n.º 3
0
        /// <inheritdoc/>
        public override Selection UpdateOnDocumentChange(DocumentChangeEventArgs e)
        {
            TextLocation newStartLocation = textArea.Document.GetLocation(e.GetNewOffset(topLeftOffset, AnchorMovementType.AfterInsertion));
            TextLocation newEndLocation = textArea.Document.GetLocation(e.GetNewOffset(bottomRightOffset, AnchorMovementType.BeforeInsertion));

            return new RectangleSelection(textArea,
                                          new TextViewPosition(newStartLocation, GetVisualColumnFromXPos(newStartLocation.Line, startXPos)),
                                          new TextViewPosition(newEndLocation, GetVisualColumnFromXPos(newEndLocation.Line, endXPos)));
        }