Ejemplo n.º 1
0
        private bool IsPointOnBlankViewLine()
        {
            DisplayTextPoint displayTextPoint = _viewPrimitives.Caret;
            DisplayTextPoint firstTextColumn  = displayTextPoint.GetFirstNonWhiteSpaceCharacterOnViewLine();

            return(firstTextColumn.CurrentPosition == displayTextPoint.EndOfViewLine);
        }
 public override DisplayTextRange GetDisplayTextRange(DisplayTextPoint otherPoint)
 {
     if (!object.ReferenceEquals(this.TextBuffer, otherPoint.TextBuffer))
     {
         throw new ArgumentException("The other point must have the same TextBuffer as this one", "otherPoint");
     }
     return(TextView.GetTextRange(this, otherPoint));
 }
        public override void MoveToBeginningOfPreviousLine()
        {
            DisplayTextPoint caret = this.CaretPoint;

            caret.MoveToBeginningOfPreviousLine();
            this.AdvancedCaret.MoveTo(caret.AdvancedTextPoint);
            this.AdvancedCaret.EnsureVisible();
        }
        public override void MoveToLine(int lineNumber)
        {
            DisplayTextPoint caretLocation = CaretPoint;

            TextView.Selection.Clear();
            caretLocation.MoveToLine(lineNumber);
            AdvancedCaret.MoveTo(caretLocation.AdvancedTextPoint);
            AdvancedCaret.EnsureVisible();
        }
        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);
        }
Ejemplo n.º 6
0
 public override bool Show(DisplayTextPoint point, HowToShow howToShow)
 {
     if (howToShow == HowToShow.AsIs)
     {
         _textView.ViewScroller.EnsureSpanVisible(new SnapshotSpan(point.AdvancedTextPoint, 0), EnsureSpanVisibleOptions.MinimumScroll);
     }
     else if (howToShow == HowToShow.Centered)
     {
         _textView.ViewScroller.EnsureSpanVisible(new SnapshotSpan(point.AdvancedTextPoint, 0), EnsureSpanVisibleOptions.AlwaysCenter);
     }
     else if (howToShow == HowToShow.OnFirstLineOfView)
     {
         _textView.DisplayTextLineContainingBufferPosition(point.AdvancedTextPoint, 0.0, ViewRelativePosition.Top);
     }
     return(point.IsVisible);
 }
Ejemplo n.º 7
0
        protected override IEnumerator <DisplayTextPoint> GetDisplayPointEnumeratorInternal()
        {
            DisplayTextPoint displayTextPoint = GetDisplayStartPoint();
            DisplayTextPoint endPoint         = GetDisplayEndPoint();

            while (displayTextPoint.CurrentPosition <= endPoint.CurrentPosition)
            {
                yield return(displayTextPoint);

                if (displayTextPoint.CurrentPosition == displayTextPoint.AdvancedTextPoint.Snapshot.Length)
                {
                    break;
                }
                displayTextPoint = displayTextPoint.Clone();
                displayTextPoint.MoveToNextCharacter();
            }
        }
        public override void MoveToStartOfLine(bool extendSelection)
        {
            VirtualSnapshotPoint oldCaretPoint = this.AdvancedCaret.Position.VirtualBufferPosition;

            DisplayTextPoint caret = this.CaretPoint;

            if ((!this.TextView.Selection.IsEmpty) && !extendSelection)
            {
                caret = this.TextView.GetTextPoint(this.TextView.Selection.AdvancedSelection.Start.Position);
            }
            caret.MoveToStartOfLine();

            if (!extendSelection)
            {
                TextView.AdvancedTextView.Selection.Clear();
            }

            this.AdvancedCaret.MoveTo(caret.AdvancedTextPoint, PositionAffinity.Successor);

            this.AdvancedCaret.EnsureVisible();
            this.UpdateSelection(extendSelection, oldCaretPoint);
        }
 public override DisplayTextRange GetDisplayTextRange(DisplayTextPoint otherPoint)
 {
     return(CaretPoint.GetDisplayTextRange(otherPoint));
 }