MS\Internal\Documents\TextBoxLine.cs (8)
81switch (position.GetPointerContext(LogicalDirection.Forward))
119ITextPointer position = _owner.Host.TextContainer.CreatePointerAtOffset(dcp, LogicalDirection.Backward);
124int runLength = Math.Min(128, position.GetTextRunLength(LogicalDirection.Backward));
126position.GetTextInRun(LogicalDirection.Backward, text, 0, runLength);
431StaticTextPointer endOfRunPosition = _owner.Host.TextContainer.Highlights.GetNextPropertyChangePosition(position, LogicalDirection.Forward);
443TextDecorationCollection highlightDecorations = highlights.GetHighlightValue(position, LogicalDirection.Forward, typeof(SpellerHighlightLayer)) as TextDecorationCollection;
461&& highlights.GetHighlightValue(position, LogicalDirection.Forward, typeof(TextSelection)) != DependencyProperty.UnsetValue)
490int charactersCopied = position.GetTextInRun(LogicalDirection.Forward, textBuffer, 0, textBuffer.Length);
MS\Internal\Documents\TextBoxView.cs (53)
633if (offset > 0 && position.LogicalDirection == LogicalDirection.Backward)
657if (position.LogicalDirection == LogicalDirection.Forward || position.Offset == 0)
664if (position.LogicalDirection == LogicalDirection.Backward && position.Offset > 0)
705firstLineIndex = Math.Max(firstLineIndex, GetLineIndexFromOffset(startOffset, LogicalDirection.Forward));
706lastLineIndex = Math.Min(lastLineIndex, GetLineIndexFromOffset(endOffset, LogicalDirection.Backward));
745ITextPointer endOfLinePosition = _host.TextContainer.CreatePointerAtOffset(_lineMetrics[lineIndex].EndOffset, LogicalDirection.Backward);
746if (TextPointerBase.IsNextToPlainLineBreak(endOfLinePosition, LogicalDirection.Backward))
785nextLinePosition = _host.TextContainer.CreatePointerAtOffset(_lineMetrics[lineIndex + linesMoved].Offset, LogicalDirection.Forward);
824if (position.LogicalDirection == LogicalDirection.Forward)
829else if (position.LogicalDirection == LogicalDirection.Backward)
854ITextPointer ITextView.GetNextCaretUnitPosition(ITextPointer position, LogicalDirection direction)
860if (position.Offset == 0 && direction == LogicalDirection.Backward)
862return position.GetFrozenPointer(LogicalDirection.Forward);
864else if (position.Offset == _host.TextContainer.SymbolCount && direction == LogicalDirection.Forward)
866return position.GetFrozenPointer(LogicalDirection.Backward);
876if (direction == LogicalDirection.Forward)
889LogicalDirection logicalDirection;
891direction == LogicalDirection.Forward)
897logicalDirection = LogicalDirection.Backward;
901logicalDirection = LogicalDirection.Forward;
905direction == LogicalDirection.Backward)
911logicalDirection = LogicalDirection.Forward;
915logicalDirection = LogicalDirection.Backward;
920logicalDirection = (nextCharacterHit.TrailingLength > 0) ? LogicalDirection.Backward : LogicalDirection.Forward;
939return position.GetFrozenPointer(LogicalDirection.Forward);
942int lineIndex = GetLineIndexFromPosition(position, LogicalDirection.Backward);
952LogicalDirection logicalDirection;
959logicalDirection = LogicalDirection.Forward;
963logicalDirection = LogicalDirection.Backward;
968logicalDirection = (backspaceCharacterHit.TrailingLength > 0) ? LogicalDirection.Backward : LogicalDirection.Forward;
986ITextPointer start = _host.TextContainer.CreatePointerAtOffset(_lineMetrics[lineIndex].Offset, LogicalDirection.Forward);
987ITextPointer end = _host.TextContainer.CreatePointerAtOffset(_lineMetrics[lineIndex].Offset + _lineMetrics[lineIndex].ContentLength, LogicalDirection.Forward);
1307ITextPointer start = _host.TextContainer.CreatePointerAtOffset(_lineMetrics[0].Offset, LogicalDirection.Backward);
1308ITextPointer end = _host.TextContainer.CreatePointerAtOffset(_lineMetrics[_lineMetrics.Count - 1].EndOffset, LogicalDirection.Forward);
1702private int GetLineIndexFromPosition(ITextPointer position, LogicalDirection direction)
1708private int GetLineIndexFromOffset(int offset, LogicalDirection direction)
1710if (offset > 0 && direction == LogicalDirection.Backward)
1756LogicalDirection logicalDirection;
1762logicalDirection = (charIndex.TrailingLength > 0) ? LogicalDirection.Backward : LogicalDirection.Forward;
1937int firstLineIndex = GetLineIndexFromOffset(range.StartIndex, LogicalDirection.Forward);
1939int lastLineIndex = GetLineIndexFromOffset(endOffset, LogicalDirection.Backward);
2059ITextPointer position = _host.TextContainer.CreatePointerAtOffset(unclippedStartOffset, LogicalDirection.Backward);
2060if (TextPointerBase.IsNextToPlainLineBreak(position, LogicalDirection.Backward))
2104ITextPointer endOfLinePosition = _host.TextContainer.CreatePointerAtOffset(endOffset, LogicalDirection.Backward);
2106if (TextPointerBase.IsNextToPlainLineBreak(endOfLinePosition, LogicalDirection.Backward))
2155ITextPointer position = _host.TextContainer.CreatePointerAtOffset(unclippedStartOffset, LogicalDirection.Backward);
2156if (TextPointerBase.IsNextToPlainLineBreak(position, LogicalDirection.Backward))
2183ITextPointer endOfLinePosition = _host.TextContainer.CreatePointerAtOffset(endOffset, LogicalDirection.Backward);
2185if (TextPointerBase.IsNextToPlainLineBreak(endOfLinePosition, LogicalDirection.Backward))
2386int lineIndex = GetLineIndexFromOffset(range.StartIndex, LogicalDirection.Forward);
MS\Internal\Documents\TextContainerHelper.cs (23)
95_textContainer.CreatePointerAtOffset(_cpFirst, LogicalDirection.Forward),
96_textContainer.CreatePointerAtOffset(_cpLast, LogicalDirection.Backward),
105_textContainer.CreatePointerAtOffset(_ranges[i * 2], LogicalDirection.Forward),
106_textContainer.CreatePointerAtOffset(_ranges[i * 2 + 1], LogicalDirection.Backward),
124if (cpPos == _cpFirst && position.LogicalDirection == LogicalDirection.Backward ||
125cpPos == _cpLast && position.LogicalDirection == LogicalDirection.Forward)
141if (cpPos == _ranges[i * 2] && position.LogicalDirection == LogicalDirection.Backward ||
142cpPos == _ranges[i * 2 + 1] && position.LogicalDirection == LogicalDirection.Forward)
160startPosition = _textContainer.CreatePointerAtOffset(IsSimple ? _cpFirst : _ranges[0], LogicalDirection.Forward);
172endPosition = _textContainer.CreatePointerAtOffset(IsSimple ? _cpLast : _ranges[(_size - 1) * 2 + 1], LogicalDirection.Backward);
324if (start.GetPointerContext(LogicalDirection.Forward) == TextPointerContext.ElementStart)
327element = start.GetAdjacentElement(LogicalDirection.Forward);
339start.MoveToNextContextPosition(LogicalDirection.Forward);
345else if (start.GetPointerContext(LogicalDirection.Forward) == TextPointerContext.EmbeddedElement)
348element = start.GetAdjacentElement(LogicalDirection.Forward);
381if (!start.MoveToNextContextPosition(LogicalDirection.Forward))
409object element = position.GetAdjacentElement(LogicalDirection.Forward);
447element = position.GetAdjacentElement(LogicalDirection.Forward);
451positionsStart.Insert(0, position.CreatePointer(LogicalDirection.Forward));
463element = position.GetAdjacentElement(LogicalDirection.Backward);
467positionsEnd.Insert(0, position.CreatePointer(LogicalDirection.Backward));
552textPointer = textContainer.CreatePointerAtOffset(0, LogicalDirection.Forward); // Start
587internal static ITextPointer GetTextPointerFromCP(ITextContainer textContainer, int cp, LogicalDirection direction)
MS\Internal\Documents\TextDocumentView.cs (29)
299internal override ITextPointer GetNextCaretUnitPosition(ITextPointer position, LogicalDirection direction)
482if (position.LogicalDirection == LogicalDirection.Forward)
492if (segment.Start.LogicalDirection == LogicalDirection.Backward)
501if (position.LogicalDirection == LogicalDirection.Backward)
511if (segment.End.LogicalDirection == LogicalDirection.Forward)
524if (position.TextContainer.Start.CompareTo(position) == 0 && position.LogicalDirection == LogicalDirection.Backward)
528else if (position.TextContainer.End.CompareTo(position) == 0 && position.LogicalDirection == LogicalDirection.Forward)
767position = paragraph.StartPosition.CreatePointer(LogicalDirection.Forward);
771position = paragraph.EndPosition.CreatePointer(LogicalDirection.Backward);
873position = blockUIContainer.ContentStart.CreatePointer(LogicalDirection.Forward);
877position = blockUIContainer.ContentEnd.CreatePointer(LogicalDirection.Backward);
887position = paragraph.StartPosition.CreatePointer(LogicalDirection.Forward);
891position = paragraph.EndPosition.CreatePointer(LogicalDirection.Backward);
1576private ITextPointer GetNextCaretUnitPosition(ReadOnlyCollection<ParagraphResult> paragraphs, ReadOnlyCollection<ParagraphResult> floatingElements, ITextPointer position, LogicalDirection direction)
1613private ITextPointer GetNextCaretUnitPosition(ParagraphResult paragraph, ITextPointer position, LogicalDirection direction)
1685private ITextPointer GetNextCaretUnitPosition(ReadOnlyCollection<ColumnResult> columns, ReadOnlyCollection<ParagraphResult> floatingElements, ITextPointer position, LogicalDirection direction)
2402lineRange = new TextSegment(blockUIContainer.ContentStart.CreatePointer(LogicalDirection.Forward), blockUIContainer.ContentEnd.CreatePointer(LogicalDirection.Backward));
2530positionOut = lines[lineIndex].StartPosition.CreatePointer(LogicalDirection.Forward);
2550positionOut = lines[0].StartPosition.CreatePointer(LogicalDirection.Forward);
2562positionOut = lines[lines.Count - 1].StartPosition.CreatePointer(LogicalDirection.Forward);
2905positionOut = blockUIContainer.ContentStart.CreatePointer(LogicalDirection.Forward);
2909positionOut = blockUIContainer.ContentEnd.CreatePointer(LogicalDirection.Backward);
3012positionOut = lines[lineIndex].StartPosition.CreatePointer(LogicalDirection.Forward);
3027positionOut = lines[0].StartPosition.CreatePointer(LogicalDirection.Forward);
3039positionOut = lines[lines.Count - 1].StartPosition.CreatePointer(LogicalDirection.Forward);
3290segmentEnd = _textContainer.Start.CreatePointer(backgroundFormatInfo.CPInterrupted, LogicalDirection.Backward);
3483if (textPointer.LogicalDirection == LogicalDirection.Forward && textPointer.CompareTo(textElement.ElementStart) == 0)
3488if (textPointer.LogicalDirection == LogicalDirection.Backward && textPointer.CompareTo(textElement.ElementEnd) == 0)
MS\Internal\PtsHost\TextParaClient.cs (56)
649RectFromDcpSimpleLines(0, 0, LogicalDirection.Forward, TextPointerContext.Text, ref textDetails.u.full, ref rect, ref vrBaseline);
654RectFromDcpCompositeLines(0, 0, LogicalDirection.Forward, TextPointerContext.Text, ref textDetails.u.full, ref rect, ref vrBaseline);
666internal ITextPointer GetTextPosition(int dcp, LogicalDirection direction)
685if (position.LogicalDirection == LogicalDirection.Backward && dcp > 0)
877internal ITextPointer GetNextCaretUnitPosition(ITextPointer position, LogicalDirection direction)
1097LogicalDirection logicalDirection = (charHit.TrailingLength > 0) ? LogicalDirection.Backward : LogicalDirection.Forward;
1638LogicalDirection orientation,
1690if (orientation == LogicalDirection.Forward)
1703if (orientation == LogicalDirection.Backward && originalDcp > 0 && (context == TextPointerContext.Text || context == TextPointerContext.EmbeddedElement))
1726LogicalDirection orientation,
1787if (orientation == LogicalDirection.Forward)
1797if (orientation == LogicalDirection.Backward && originalDcp > 0 && (context == TextPointerContext.Text || context == TextPointerContext.EmbeddedElement))
2040ITextPointer position = Paragraph.StructuralCache.TextContainer.CreatePointerAtOffset(Paragraph.ParagraphStartCharacterPosition + dcp, LogicalDirection.Forward);
2042return (TextPointerBase.IsNextToAnyBreak(position, LogicalDirection.Backward));
2404if (position.LogicalDirection == LogicalDirection.Backward)
2429else if (position.LogicalDirection == LogicalDirection.Forward)
2507if (position.LogicalDirection == LogicalDirection.Backward)
2553else if (position.LogicalDirection == LogicalDirection.Forward)
2589LogicalDirection direction,
2614if (dcp == lineDesc.dcpFirst && direction == LogicalDirection.Backward)
2629else if (dcp >= lineDesc.dcpLim - 1 && direction == LogicalDirection.Forward)
2658if (direction == LogicalDirection.Forward)
2667LogicalDirection logicalDirection;
2668if ((nextCharacterHit.FirstCharacterIndex + nextCharacterHit.TrailingLength == lineDesc.dcpLim) && direction == LogicalDirection.Forward)
2674logicalDirection = LogicalDirection.Backward;
2678logicalDirection = LogicalDirection.Forward;
2681else if ((nextCharacterHit.FirstCharacterIndex + nextCharacterHit.TrailingLength == lineDesc.dcpFirst) && direction == LogicalDirection.Backward)
2687logicalDirection = LogicalDirection.Forward;
2691logicalDirection = LogicalDirection.Backward;
2696logicalDirection = (nextCharacterHit.TrailingLength > 0) ? LogicalDirection.Backward : LogicalDirection.Forward;
2714LogicalDirection direction,
2748if (dcp == element.dcpFirst && direction == LogicalDirection.Backward)
2788else if (dcp >= element.dcpLim - 1 && direction == LogicalDirection.Forward)
2821if (direction == LogicalDirection.Forward)
2830LogicalDirection logicalDirection;
2831if ((nextCharacterHit.FirstCharacterIndex + nextCharacterHit.TrailingLength == element.dcpLim) && direction == LogicalDirection.Forward)
2837logicalDirection = LogicalDirection.Backward;
2842logicalDirection = LogicalDirection.Forward;
2845else if ((nextCharacterHit.FirstCharacterIndex + nextCharacterHit.TrailingLength == element.dcpFirst) && direction == LogicalDirection.Backward)
2851logicalDirection = LogicalDirection.Forward;
2856logicalDirection = LogicalDirection.Backward;
2861logicalDirection = (nextCharacterHit.TrailingLength > 0) ? LogicalDirection.Backward : LogicalDirection.Forward;
2937LogicalDirection logicalDirection;
2944logicalDirection = LogicalDirection.Forward;
2948logicalDirection = LogicalDirection.Backward;
2953logicalDirection = (backspaceCharacterHit.TrailingLength > 0) ? LogicalDirection.Backward : LogicalDirection.Forward;
3063LogicalDirection logicalDirection;
3070logicalDirection = LogicalDirection.Forward;
3074logicalDirection = LogicalDirection.Backward;
3079logicalDirection = (backspaceCharacterHit.TrailingLength > 0) ? LogicalDirection.Backward : LogicalDirection.Forward;
MS\Internal\Text\ComplexLine.cs (17)
47switch (position.GetPointerContext(LogicalDirection.Forward))
94ITextPointer position = _owner.TextContainer.CreatePointerAtOffset(dcp, LogicalDirection.Backward);
97while (position.GetPointerContext(LogicalDirection.Backward) != TextPointerContext.Text &&
105string precedingTextString = position.GetTextInRun(LogicalDirection.Backward);
288position = new TextPointer(_owner.ContentStart, CalcPositionOffset(charHit), LogicalDirection.Forward);
295type = position.GetPointerContext(LogicalDirection.Forward);
300type = position.GetPointerContext(LogicalDirection.Backward);
311element = position.GetAdjacentElementFromOuterPosition(LogicalDirection.Forward);
339Debug.Assert(position.GetPointerContext(LogicalDirection.Forward) == TextPointerContext.Text, "TextPointer does not point to characters.");
358endOfRunPosition = _owner.Highlights.GetNextPropertyChangePosition(position, LogicalDirection.Forward);
373int charactersCopied = position.GetTextInRun(LogicalDirection.Forward, textBuffer, 0, textBuffer.Length);
386Debug.Assert(position.GetPointerContext(LogicalDirection.Forward) == TextPointerContext.ElementStart, "TextPointer does not point to element start edge.");
390TextElement element = (TextElement)position.GetAdjacentElement(LogicalDirection.Forward);
477Debug.Assert(position.GetPointerContext(LogicalDirection.Forward) == TextPointerContext.ElementEnd, "TextPointer does not point to element end edge.");
481TextElement element = (TextElement)position.GetAdjacentElement(LogicalDirection.Forward);
527Debug.Assert(position.GetPointerContext(LogicalDirection.Forward) == TextPointerContext.EmbeddedElement, "TextPointer does not point to embedded object.");
530DependencyObject element = position.GetAdjacentElement(LogicalDirection.Forward) as DependencyObject;
System\Windows\Controls\PasswordTextContainer.cs (20)
215ITextPointer ITextContainer.CreatePointerAtOffset(int offset, LogicalDirection direction)
221ITextPointer ITextContainer.CreatePointerAtCharOffset(int charOffset, LogicalDirection direction)
226ITextPointer ITextContainer.CreateDynamicTextPointer(StaticTextPointer position, LogicalDirection direction)
233return new StaticTextPointer(this, ((ITextContainer)this).CreatePointerAtOffset(offset, LogicalDirection.Forward));
236TextPointerContext ITextContainer.GetPointerContext(StaticTextPointer pointer, LogicalDirection direction)
246int ITextContainer.GetTextInRun(StaticTextPointer position, LogicalDirection direction, char[] textBuffer, int startIndex, int count)
251object ITextContainer.GetAdjacentElement(StaticTextPointer position, LogicalDirection direction)
266StaticTextPointer ITextContainer.GetNextContextPosition(StaticTextPointer position, LogicalDirection direction)
517return new PasswordTextPointer(this, LogicalDirection.Backward, 0);
531return new PasswordTextPointer(this, LogicalDirection.Forward, this.SymbolCount);
673textPosition = new PasswordTextPointer(this, LogicalDirection.Forward, offset);
710index = FindIndex(offset, LogicalDirection.Forward);
743if (position.LogicalDirection == LogicalDirection.Backward)
807private int FindIndex(int offset, LogicalDirection gravity)
821(position.LogicalDirection == gravity || gravity == LogicalDirection.Backward))
842LogicalDirection lastLogicalDirection;
845lastLogicalDirection = LogicalDirection.Backward;
857position.LogicalDirection == LogicalDirection.Backward &&
862Invariant.Assert(lastLogicalDirection != LogicalDirection.Forward);
913Debug.Write($"({position.DebugId}) {position.Offset}/{((position.LogicalDirection == LogicalDirection.Forward) ? "f " : "b ")}");
System\Windows\Controls\TextBox.cs (24)
166TextPointer newStart = this.TextContainer.CreatePointerAtOffset(start, LogicalDirection.Forward);
170newStart = newStart.GetInsertionPosition(LogicalDirection.Forward);
178TextPointer newEnd = new TextPointer(newStart, length, LogicalDirection.Forward);
181newEnd = newEnd.GetInsertionPosition(LogicalDirection.Forward);
221return (textPointer.LogicalDirection == LogicalDirection.Backward) ? offset - 1 : offset;
269TextPointer position = this.TextContainer.CreatePointerAtOffset(charIndex, LogicalDirection.Forward);
444TextPointer textPointer = TextContainer.CreatePointerAtOffset(charIndex, LogicalDirection.Backward);
445textPointer = textPointer.GetInsertionPosition(LogicalDirection.Backward);
450textPointer = textPointer.GetNextInsertionPosition(LogicalDirection.Forward);
454textPointer = textPointer.GetPositionAtOffset(0, LogicalDirection.Backward);
459textPointer = textPointer.GetPositionAtOffset(0, LogicalDirection.Forward);
484TextPointer position = this.TextContainer.CreatePointerAtOffset(charIndex, LogicalDirection.Forward);
485SpellingError spellingError = this.TextEditor.GetSpellingErrorAtPosition(position, LogicalDirection.Forward);
489position = this.TextContainer.CreatePointerAtOffset(charIndex + 1, LogicalDirection.Forward);
490spellingError = this.TextEditor.GetSpellingErrorAtPosition(position, LogicalDirection.Backward);
550public int GetNextSpellingErrorCharacterIndex(int charIndex, LogicalDirection direction)
816TextPointer newEnd = new TextPointer(TextSelectionInternal.Start, value, LogicalDirection.Forward);
819newEnd = newEnd.GetInsertionPosition(LogicalDirection.Forward);
860TextPointer newStart = TextContainer.CreatePointerAtOffset(value, LogicalDirection.Forward);
864newStart = newStart.GetInsertionPosition(LogicalDirection.Forward);
872TextPointer newEnd = new TextPointer(newStart, selectionLength, LogicalDirection.Forward);
875newEnd = newEnd.GetInsertionPosition(LogicalDirection.Forward);
1482if (TextPointerBase.IsNextToPlainLineBreak(textPointer, LogicalDirection.Forward))
1484textPointer.MoveToNextInsertionPosition(LogicalDirection.Forward);
System\Windows\Controls\TextRangeAdaptor.cs (77)
482internal static bool MoveToInsertionPosition(ITextPointer position, LogicalDirection direction)
530TextPointerBase.MoveToNextInsertionPosition(_start, LogicalDirection.Backward);
534TextPointerBase.MoveToNextInsertionPosition(_end, LogicalDirection.Forward);
541MoveToNextWordBoundary(_start, LogicalDirection.Backward);
545MoveToNextWordBoundary(_end, LogicalDirection.Forward);
555TextPointerContext forwardContext = _start.GetPointerContext(LogicalDirection.Forward);
558TextPointerContext backwardContext = _start.GetPointerContext(LogicalDirection.Backward);
566_start.MoveToNextContextPosition(LogicalDirection.Backward);
572TextPointerContext backwardContext = _end.GetPointerContext(LogicalDirection.Backward);
575TextPointerContext forwardContext = _end.GetPointerContext(LogicalDirection.Forward);
583_end.MoveToNextContextPosition(LogicalDirection.Forward);
589_start.SetLogicalDirection(LogicalDirection.Forward);
590_end.SetLogicalDirection(LogicalDirection.Forward);
727private bool MoveToUnitBoundary(ITextPointer position, bool isStart, LogicalDirection direction, TextUnit unit)
765if (moved && direction == LogicalDirection.Forward)
769TextPointerContext context = position.GetPointerContext(LogicalDirection.Forward);
774position.MoveToNextContextPosition(LogicalDirection.Forward);
793if (direction == LogicalDirection.Forward)
811nextLineStart = GetInsertionPosition(nextLineStart, LogicalDirection.Forward);
816position.SetLogicalDirection(isStart ? LogicalDirection.Forward : LogicalDirection.Backward);
838previousLineEnd = GetInsertionPosition(previousLineEnd, LogicalDirection.Backward);
843position.SetLogicalDirection(isStart ? LogicalDirection.Forward : LogicalDirection.Backward);
856if (direction == LogicalDirection.Forward)
863if (nextParagraphStart.MoveToNextInsertionPosition(LogicalDirection.Forward))
873position.SetLogicalDirection(isStart ? LogicalDirection.Forward : LogicalDirection.Backward);
884if (previousParagraphEnd.MoveToNextInsertionPosition(LogicalDirection.Backward))
894position.SetLogicalDirection(isStart ? LogicalDirection.Forward : LogicalDirection.Backward);
923if (direction == LogicalDirection.Forward)
927if (position.GetPointerContext(LogicalDirection.Forward) != TextPointerContext.ElementEnd)
933Invariant.Assert(position.MoveToNextContextPosition(LogicalDirection.Forward));
935MoveToInsertionPosition(position, LogicalDirection.Forward);
941if (position.GetPointerContext(LogicalDirection.Backward) != TextPointerContext.ElementStart)
947Invariant.Assert(position.MoveToNextContextPosition(LogicalDirection.Backward));
949MoveToInsertionPosition(position, LogicalDirection.Backward);
956if (direction == LogicalDirection.Forward)
958if (position.CompareTo(GetInsertionPosition(position.TextContainer.End, LogicalDirection.Backward)) != 0)
966if (position.CompareTo(GetInsertionPosition(position.TextContainer.Start, LogicalDirection.Forward)) != 0)
996LogicalDirection direction = (count > 0) ? LogicalDirection.Forward : LogicalDirection.Backward;
1053if (direction == LogicalDirection.Backward)
1055while (position.GetPointerContext(LogicalDirection.Backward) == TextPointerContext.Text)
1057if (!position.MoveToNextContextPosition(LogicalDirection.Backward))
1077position.SetLogicalDirection(LogicalDirection.Forward);
1094position.MoveToNextInsertionPosition(LogicalDirection.Backward);
1099MoveToInsertionPosition(position, LogicalDirection.Forward);
1114position.MoveToPosition(direction == LogicalDirection.Forward ? paragraphRange.End : paragraphRange.Start);
1145if (direction == LogicalDirection.Backward)
1148MoveToInsertionPosition(position, LogicalDirection.Backward);
1153MoveToInsertionPosition(position, LogicalDirection.Forward);
1165if (direction == LogicalDirection.Forward)
1198return (direction == LogicalDirection.Forward) ? moved : -moved;
1213while (IsElementBoundary(start.GetPointerContext(LogicalDirection.Forward)))
1215if (!start.MoveToNextContextPosition(LogicalDirection.Forward) || start.CompareTo(end) >= 0)
1220while (IsElementBoundary(end.GetPointerContext(LogicalDirection.Backward)))
1222if (!end.MoveToNextContextPosition(LogicalDirection.Backward) || start.CompareTo(end) >= 0)
1237if (!start.MoveToNextContextPosition(LogicalDirection.Forward) || start.CompareTo(end) > 0)
1448return TextPointerBase.IsAtWordBoundary(position, LogicalDirection.Forward);
1456private static bool MoveToNextWordBoundary(ITextPointer position, LogicalDirection direction)
1482position.SetLogicalDirection(LogicalDirection.Forward);
1507private ITextPointer GetInsertionPosition(ITextPointer position, LogicalDirection direction)
1640_end.MoveToNextInsertionPosition(LogicalDirection.Forward);
1675ITextPointer position = _end.CreatePointer(LogicalDirection.Backward);
1686attrEnd = position.CreatePointer(LogicalDirection.Backward);
1693attrStart = position.CreatePointer(LogicalDirection.Forward);
1697if (!position.MoveToNextContextPosition(LogicalDirection.Backward))
1706ITextPointer position = _start.CreatePointer(LogicalDirection.Forward);
1717attrStart = position.CreatePointer(LogicalDirection.Forward);
1724attrEnd = position.CreatePointer(LogicalDirection.Backward);
1728if (!position.MoveToNextContextPosition(LogicalDirection.Forward))
1911_end.MoveToNextInsertionPosition(LogicalDirection.Forward);
1949if (MoveToUnitBoundary(position, start, count < 0 ? LogicalDirection.Backward : LogicalDirection.Forward, unit))
System\Windows\Documents\DocumentSequenceTextContainer.cs (25)
111ITextPointer ITextContainer.CreatePointerAtOffset(int offset, LogicalDirection direction)
117ITextPointer ITextContainer.CreatePointerAtCharOffset(int charOffset, LogicalDirection direction)
122ITextPointer ITextContainer.CreateDynamicTextPointer(StaticTextPointer position, LogicalDirection direction)
129return new StaticTextPointer(this, ((ITextContainer)this).CreatePointerAtOffset(offset, LogicalDirection.Forward));
132TextPointerContext ITextContainer.GetPointerContext(StaticTextPointer pointer, LogicalDirection direction)
142int ITextContainer.GetTextInRun(StaticTextPointer position, LogicalDirection direction, char[] textBuffer, int startIndex, int count)
147object ITextContainer.GetAdjacentElement(StaticTextPointer position, LogicalDirection direction)
162StaticTextPointer ITextContainer.GetNextContextPosition(StaticTextPointer position, LogicalDirection direction)
677if (!highlights.IsContentHighlighted(highlightTransitionPosition, LogicalDirection.Forward))
679highlightTransitionPosition = highlights.GetNextHighlightChangePosition(highlightTransitionPosition, LogicalDirection.Forward);
687selected = highlights.GetHighlightValue(highlightTransitionPosition, LogicalDirection.Forward, typeof(TextSelection));
691highlightTransitionPosition = highlights.GetNextHighlightChangePosition(highlightTransitionPosition, LogicalDirection.Forward);
698if (highlightRangeStart.GetPointerContext(LogicalDirection.Forward) != TextPointerContext.Text)
705TextPointerBase.GetTextWithLimit(highlightRangeStart.CreateDynamicTextPointer(LogicalDirection.Forward), LogicalDirection.Forward, sb, 0, 256, highlightTransitionPosition.CreateDynamicTextPointer(LogicalDirection.Forward));
880internal override object GetHighlightValue(StaticTextPointer textPosition, LogicalDirection direction, Type highlightLayerOwnerType)
901internal override bool IsContentHighlighted(StaticTextPointer textPosition, LogicalDirection direction)
923internal override StaticTextPointer GetNextHighlightChangePosition(StaticTextPointer textPosition, LogicalDirection direction)
966internal override StaticTextPointer GetNextPropertyChangePosition(StaticTextPointer textPosition, LogicalDirection direction)
991private bool EnsureParentPosition(StaticTextPointer textPosition, LogicalDirection direction, out StaticTextPointer parentPosition)
1005ITextPointer dynamicTextPointer = textPosition.CreateDynamicTextPointer(LogicalDirection.Forward);
1023private StaticTextPointer GetStaticPositionInChildContainer(StaticTextPointer textPosition, LogicalDirection direction, StaticTextPointer originalPosition)
1029DocumentSequenceTextPointer parentChangePosition = textPosition.CreateDynamicTextPointer(LogicalDirection.Forward) as DocumentSequenceTextPointer;
1042childTp = direction == LogicalDirection.Forward ?
System\Windows\Documents\DocumentSequenceTextPointer.cs (52)
55void ITextPointer.SetLogicalDirection(LogicalDirection direction)
88TextPointerContext ITextPointer.GetPointerContext(LogicalDirection direction)
97int ITextPointer.GetTextRunLength(LogicalDirection direction)
103string ITextPointer.GetTextInRun(LogicalDirection direction)
109/// <see cref="ITextPointer.GetTextInRun(LogicalDirection,char[],int,int)"/>
112int ITextPointer.GetTextInRun(LogicalDirection direction, char[] textBuffer, int startIndex, int count)
121object ITextPointer.GetAdjacentElement(LogicalDirection direction)
130Type ITextPointer.GetElementType(LogicalDirection direction)
198/// <see cref="ITextPointer.CreatePointer(LogicalDirection)"/>
200ITextPointer ITextPointer.CreatePointer(LogicalDirection gravity)
206/// <see cref="ITextPointer.CreatePointer(int,LogicalDirection)"/>
208ITextPointer ITextPointer.CreatePointer(int distance, LogicalDirection gravity)
222ITextPointer ITextPointer.GetFrozenPointer(LogicalDirection logicalDirection)
251ITextPointer ITextPointer.GetNextContextPosition(LogicalDirection direction)
266ITextPointer ITextPointer.GetInsertionPosition(LogicalDirection direction)
277ITextPointer ITextPointer.GetFormatNormalizedPosition(LogicalDirection direction)
286ITextPointer ITextPointer.GetNextInsertionPosition(LogicalDirection direction)
367if (!isAtCaretUnitBoundary && ((ITextPointer)this).LogicalDirection == LogicalDirection.Backward)
375ITextPointer positionForwardGravity = ((ITextPointer)this).CreatePointer(LogicalDirection.Forward);
385LogicalDirection ITextPointer.LogicalDirection
451bool ITextPointer.MoveToNextContextPosition(LogicalDirection direction)
484LogicalDirection gravity = this.ChildPointer.LogicalDirection;
514Rect ITextPointer.GetCharacterRect(LogicalDirection direction)
519bool ITextPointer.MoveToInsertionPosition(LogicalDirection direction)
524bool ITextPointer.MoveToNextInsertionPosition(LogicalDirection direction)
639public static TextPointerContext GetPointerContext(DocumentSequenceTextPointer thisTp, LogicalDirection direction)
650public static int GetTextRunLength(DocumentSequenceTextPointer thisTp, LogicalDirection direction)
658/// <see cref="ITextPointer.GetTextInRun(LogicalDirection,char[],int,int)"/>
661public static int GetTextInRun(DocumentSequenceTextPointer thisTp, LogicalDirection direction, char[] textBuffer, int startIndex, int count)
690public static object GetAdjacentElement(DocumentSequenceTextPointer thisTp, LogicalDirection direction)
701public static Type GetElementType(DocumentSequenceTextPointer thisTp, LogicalDirection direction)
774public static ITextPointer CreatePointer(DocumentSequenceTextPointer thisTp, LogicalDirection gravity)
780/// <see cref="ITextPointer.CreatePointer(int,LogicalDirection)"/>
782public static ITextPointer CreatePointer(DocumentSequenceTextPointer thisTp, int distance, LogicalDirection gravity)
827internal static bool iScan(DocumentSequenceTextPointer thisTp, LogicalDirection direction)
832moved = xGapAwareScan(thisTp, (direction == LogicalDirection.Forward ? 1 : -1));
872private static DocumentSequenceTextPointer xGetClingDSTP(DocumentSequenceTextPointer thisTp, LogicalDirection direction)
884if (direction == LogicalDirection.Forward)
897Debug.Assert(direction == LogicalDirection.Backward);
922private static TextPointerContext xGapAwareGetSymbolType(DocumentSequenceTextPointer thisTp, LogicalDirection direction)
929private static object xGapAwareGetEmbeddedElement(DocumentSequenceTextPointer thisTp, LogicalDirection direction)
973if (tp1.ChildPointer.GetPointerContext(LogicalDirection.Forward) != TextPointerContext.None ||
974tp2.ChildPointer.GetPointerContext(LogicalDirection.Backward) != TextPointerContext.None)
983if (block.ChildContainer.Start.GetPointerContext(LogicalDirection.Forward) != TextPointerContext.None)
1038LogicalDirection scanDir = (distance > 0 ? LogicalDirection.Forward : LogicalDirection.Backward);
1066if (scanDir == LogicalDirection.Backward)
1074if (!((cdb.IsHead && scanDir == LogicalDirection.Backward)
1075|| (cdb.IsTail && scanDir == LogicalDirection.Forward)
1079cdb = (scanDir == LogicalDirection.Forward ? cdb.NextBlock : cdb.PreviousBlock);
1080childTn = (scanDir == LogicalDirection.Forward ?
System\Windows\Documents\FixedDocument.cs (11)
509fixedTextPointer = new FixedTextPointer(true, LogicalDirection.Forward, flowPosition);
1080if (!highlights.IsContentHighlighted(highlightTransitionPosition, LogicalDirection.Forward))
1082highlightTransitionPosition = highlights.GetNextHighlightChangePosition(highlightTransitionPosition, LogicalDirection.Forward);
1093selected = highlights.GetHighlightValue(highlightTransitionPosition, LogicalDirection.Forward, typeof(TextSelection));
1111highlightTransitionPosition = highlights.GetNextHighlightChangePosition(highlightTransitionPosition, LogicalDirection.Forward);
1114while (highlights.GetHighlightValue(highlightTransitionPosition, LogicalDirection.Forward, typeof(TextSelection)) != DependencyProperty.UnsetValue);
1123LogicalDirection.Forward, typeof(HighlightComponent)) as AnnotationHighlightLayer.HighlightSegment;
1127highlightTransitionPosition = highlights.GetNextHighlightChangePosition(highlightTransitionPosition, LogicalDirection.Forward);
1137this.FixedContainer.GetMultiHighlights((FixedTextPointer)highlightRangeStart.CreateDynamicTextPointer(LogicalDirection.Forward),
1138(FixedTextPointer)highlightTransitionPosition.CreateDynamicTextPointer(LogicalDirection.Forward),
1443return new FixedTextPointer(true, LogicalDirection.Forward, flowPosition);
System\Windows\Documents\FixedFindEngine.cs (12)
153end = new DocumentSequenceTextPointer(childBlock, new FixedTextPointer(false, LogicalDirection.Backward, fixedDoc.FixedContainer.FixedTextBuilder.GetPageEndFlowPosition(translatedPageNumber)));
154start = new DocumentSequenceTextPointer(childBlock, new FixedTextPointer(false, LogicalDirection.Forward, fixedDoc.FixedContainer.FixedTextBuilder.GetPageStartFlowPosition(translatedPageNumber)));
158start = new DocumentSequenceTextPointer(childBlock, new FixedTextPointer(false, LogicalDirection.Forward, fixedDoc.FixedContainer.FixedTextBuilder.GetPageStartFlowPosition(translatedPageNumber)));
159end = new DocumentSequenceTextPointer(childBlock, new FixedTextPointer(false, LogicalDirection.Backward, fixedDoc.FixedContainer.FixedTextBuilder.GetPageEndFlowPosition(translatedPageNumber)));
168end = new FixedTextPointer(false, LogicalDirection.Backward, textBuilder.GetPageEndFlowPosition(pageNumber));
169start = new FixedTextPointer(false, LogicalDirection.Forward, textBuilder.GetPageStartFlowPosition(pageNumber));
173start = new FixedTextPointer(false, LogicalDirection.Forward, textBuilder.GetPageStartFlowPosition(pageNumber));
174end = new FixedTextPointer(false, LogicalDirection.Backward, textBuilder.GetPageEndFlowPosition(pageNumber));
306new FixedTextPointer(false, LogicalDirection.Forward,pageStartFlowPosition));
312firstSearchPageStart = new FixedTextPointer(false, LogicalDirection.Forward, endAsFTP.FixedTextContainer.FixedTextBuilder.GetPageStartFlowPosition(pageNumber));
326new FixedTextPointer(false, LogicalDirection.Backward, pageEndFlowPosition));
332firstSearchPageEnd = new FixedTextPointer(false, LogicalDirection.Backward, startAsFTP.FixedTextContainer.FixedTextBuilder.GetPageEndFlowPosition(pageNumber));
System\Windows\Documents\FixedTextContainer.cs (12)
96ITextPointer ITextContainer.CreatePointerAtOffset(int offset, LogicalDirection direction)
102ITextPointer ITextContainer.CreatePointerAtCharOffset(int charOffset, LogicalDirection direction)
107ITextPointer ITextContainer.CreateDynamicTextPointer(StaticTextPointer position, LogicalDirection direction)
114return new StaticTextPointer(this, ((ITextContainer)this).CreatePointerAtOffset(offset, LogicalDirection.Forward));
117TextPointerContext ITextContainer.GetPointerContext(StaticTextPointer pointer, LogicalDirection direction)
127int ITextContainer.GetTextInRun(StaticTextPointer position, LogicalDirection direction, char[] textBuffer, int startIndex, int count)
132object ITextContainer.GetAdjacentElement(StaticTextPointer position, LogicalDirection direction)
147StaticTextPointer ITextContainer.GetNextContextPosition(StaticTextPointer position, LogicalDirection direction)
586_start = new FixedTextPointer(false, LogicalDirection.Backward, new FlowPosition(this, this.FixedTextBuilder.FixedFlowMap.FlowStartEdge, 1));
587_end = new FixedTextPointer(false, LogicalDirection.Forward, new FlowPosition(this, this.FixedTextBuilder.FixedFlowMap.FlowEndEdge, 0));
596FixedTextPointer eStart = new FixedTextPointer(false, LogicalDirection.Backward, pStart);
597FixedTextPointer eEnd = new FixedTextPointer(false, LogicalDirection.Forward, pEnd);
System\Windows\Documents\FixedTextPointer.cs (27)
38internal FixedTextPointer(bool mutable, LogicalDirection gravity, FlowPosition flow)
100TextPointerContext ITextPointer.GetPointerContext(LogicalDirection direction)
110int ITextPointer.GetTextRunLength(LogicalDirection direction)
121string ITextPointer.GetTextInRun(LogicalDirection direction)
127/// <see cref="ITextPointer.GetTextInRun(LogicalDirection,char[],int,int)"/>
130int ITextPointer.GetTextInRun(LogicalDirection direction, char[] textBuffer, int startIndex, int count)
150object ITextPointer.GetAdjacentElement(LogicalDirection direction)
165Type ITextPointer.GetElementType(LogicalDirection direction)
266/// <see cref="ITextPointer.CreatePointer(LogicalDirection)"/>
268ITextPointer ITextPointer.CreatePointer(LogicalDirection gravity)
274/// <see cref="ITextPointer.CreatePointer(int,LogicalDirection)"/>
276ITextPointer ITextPointer.CreatePointer(int distance, LogicalDirection gravity)
300ITextPointer ITextPointer.GetFrozenPointer(LogicalDirection logicalDirection)
309ITextPointer ITextPointer.GetNextContextPosition(LogicalDirection direction)
327ITextPointer ITextPointer.GetInsertionPosition(LogicalDirection direction)
341ITextPointer ITextPointer.GetFormatNormalizedPosition(LogicalDirection direction)
353ITextPointer ITextPointer.GetNextInsertionPosition(LogicalDirection direction)
373void ITextPointer.SetLogicalDirection(LogicalDirection direction)
383bool ITextPointer.MoveToNextContextPosition(LogicalDirection direction)
470Rect ITextPointer.GetCharacterRect(LogicalDirection direction)
478bool ITextPointer.MoveToInsertionPosition(LogicalDirection direction)
486bool ITextPointer.MoveToNextInsertionPosition(LogicalDirection direction)
576if (!isAtCaretUnitBoundary && this.LogicalDirection == LogicalDirection.Backward)
584ITextPointer positionForwardGravity = ((ITextPointer)this).CreatePointer(LogicalDirection.Forward);
594LogicalDirection ITextPointer.LogicalDirection
670internal LogicalDirection LogicalDirection
703private LogicalDirection _gravity;
System\Windows\Documents\FixedTextView.cs (43)
83textPos = _CreateTextPointer(fixedp, LogicalDirection.Backward);
107pos = _CreateTextPointer(fixedp, LogicalDirection.Forward);
115pos = _CreateTextPointer(fixedp, LogicalDirection.Forward);
186if (position.GetPointerContext(LogicalDirection.Forward) != TextPointerContext.None)
346LogicalDirection edge = position.LogicalDirection;
347LogicalDirection scanDir = LogicalDirection.Forward;
368scanDir = LogicalDirection.Backward;
382linesMoved = (scanDir == LogicalDirection.Forward) ? 1 : -1;
407if (scanDir == LogicalDirection.Backward)
514internal override ITextPointer GetNextCaretUnitPosition(ITextPointer position, LogicalDirection direction)
531CharacterHit next = (direction == LogicalDirection.Forward) ?
537LogicalDirection edge = LogicalDirection.Forward;
540edge = LogicalDirection.Backward;
618ITextPointer begin = _CreateTextPointer(new FixedPosition(fixedNodes[0], 0), LogicalDirection.Forward);
619ITextPointer end = _CreateTextPointer(new FixedPosition(lastNode, lastIndex), LogicalDirection.Backward);
651(tp.CompareTo(this.Start) == 0 && (tp.LogicalDirection == LogicalDirection.Forward || this.IsContainerStart)) ||
652(tp.CompareTo(this.End) == 0 && (tp.LogicalDirection == LogicalDirection.Backward || this.IsContainerEnd))
746_start = new FixedTextPointer(false, LogicalDirection.Forward, flowStart);
759_end = new FixedTextPointer(false, LogicalDirection.Backward, flowEnd);
798private void _GlyphRunHitTest(Glyphs g, double xoffset, out int charIndex, out LogicalDirection edge)
801edge = LogicalDirection.Forward;
819edge = (hit.TrailingLength > 0) ? LogicalDirection.Backward : LogicalDirection.Forward;
862LogicalDirection dir;
876itp = ((ITextPointer)this.Start).CreatePointer(LogicalDirection.Forward);
877itp.MoveToInsertionPosition(LogicalDirection.Forward);
881itp = ((ITextPointer)this.End).CreatePointer(LogicalDirection.Backward);
882itp.MoveToInsertionPosition(LogicalDirection.Backward);
891private bool _GetNextLineGlyphs(ref FixedPosition fixedp, ref LogicalDirection edge, double suggestedX, LogicalDirection scanDir)
896FixedNode[] fixedNodes = Container.FixedTextBuilder.GetNextLine(fixedp.Node, (scanDir == LogicalDirection.Forward), ref count);
1089LogicalDirection textdir = ftp.LogicalDirection;
1103textdir = LogicalDirection.Forward;
1106textdir = LogicalDirection.Backward;
1143LogicalDirection dir = LogicalDirection.Forward;
1147dir = LogicalDirection.Backward;
1176private ITextPointer _CreateTextPointer(FixedPosition fixedPosition, LogicalDirection edge)
1201LogicalDirection edge;
1211LogicalDirection dir = textPointer.LogicalDirection;
1212int increment = (dir == LogicalDirection.Forward ? +1 : -1);
System\Windows\Documents\ImmComposition.cs (25)
648caretNavigator = _caretOffset > 0 ? _startComposition.CreatePointer(_caretOffset, LogicalDirection.Forward) : _endComposition;
655ITextPointer startPosition = startNavigator.CreatePointer(LogicalDirection.Forward);
656ITextPointer endPosition = endNavigator.CreatePointer(LogicalDirection.Backward);
657ITextPointer caretPosition = caretNavigator.CreatePointer(LogicalDirection.Forward);
777rectCaret = view.GetRectangleFromTextPosition(_editor.Selection.End.CreatePointer(LogicalDirection.Backward));
1145start = range.Start.CreatePointer(resultLength, LogicalDirection.Forward);
1149ITextPointer caretPosition = _caretOffset >= 0 ? start.CreatePointer(_caretOffset, LogicalDirection.Forward) : end;
1188ITextPointer startAttribute = _startComposition.CreatePointer(startOffset, LogicalDirection.Backward);
1189ITextPointer endAttribute = _startComposition.CreatePointer(i + 1, LogicalDirection.Forward);
1419switch (navigator.GetPointerContext(LogicalDirection.Backward))
1423int copied = navigator.GetTextInRun(LogicalDirection.Backward, buffer, 0, buffer.Length);
1437if (!navigator.GetElementType(LogicalDirection.Backward).IsSubclassOf(typeof(Inline)))
1441navigator.MoveToNextContextPosition(LogicalDirection.Backward);
1450navigator.MoveToNextContextPosition(LogicalDirection.Backward);
1471switch (navigator.GetPointerContext(LogicalDirection.Forward))
1475int copied = navigator.GetTextInRun(LogicalDirection.Forward, buffer, 0, buffer.Length);
1488if (!navigator.GetElementType(LogicalDirection.Forward).IsSubclassOf(typeof(Inline)))
1492navigator.MoveToNextContextPosition(LogicalDirection.Forward);
1500navigator.MoveToNextContextPosition(LogicalDirection.Forward);
1543ITextPointer start = range.Start.CreatePointer(LogicalDirection.Backward);
1548ITextPointer end = start.CreatePointer(LogicalDirection.Forward);
1570switch (position.GetPointerContext(LogicalDirection.Backward))
1586switch (position.GetPointerContext(LogicalDirection.Forward))
1673positionNext.MoveToNextInsertionPosition(LogicalDirection.Forward);
1677positionNext.MoveToNextInsertionPosition(LogicalDirection.Backward);
System\Windows\Documents\ITextContainer.cs (7)
38ITextPointer CreatePointerAtOffset(int offset, LogicalDirection direction);
43ITextPointer CreatePointerAtCharOffset(int charOffset, LogicalDirection direction);
45ITextPointer CreateDynamicTextPointer(StaticTextPointer position, LogicalDirection direction);
49TextPointerContext GetPointerContext(StaticTextPointer pointer, LogicalDirection direction);
53int GetTextInRun(StaticTextPointer position, LogicalDirection direction, char[] textBuffer, int startIndex, int count);
55object GetAdjacentElement(StaticTextPointer position, LogicalDirection direction);
61StaticTextPointer GetNextContextPosition(StaticTextPointer position, LogicalDirection direction);
System\Windows\Documents\NullTextContainer.cs (10)
39_start = new NullTextPointer(this, LogicalDirection.Backward);
40_end = new NullTextPointer(this, LogicalDirection.Forward);
84ITextPointer ITextContainer.CreatePointerAtOffset(int offset, LogicalDirection direction)
90ITextPointer ITextContainer.CreatePointerAtCharOffset(int charOffset, LogicalDirection direction)
95ITextPointer ITextContainer.CreateDynamicTextPointer(StaticTextPointer position, LogicalDirection direction)
102return new StaticTextPointer(this, ((ITextContainer)this).CreatePointerAtOffset(offset, LogicalDirection.Forward));
105TextPointerContext ITextContainer.GetPointerContext(StaticTextPointer pointer, LogicalDirection direction)
115int ITextContainer.GetTextInRun(StaticTextPointer position, LogicalDirection direction, char[] textBuffer, int startIndex, int count)
120object ITextContainer.GetAdjacentElement(StaticTextPointer position, LogicalDirection direction)
135StaticTextPointer ITextContainer.GetNextContextPosition(StaticTextPointer position, LogicalDirection direction)
System\Windows\Documents\Speller.cs (46)
111internal SpellingError GetError(ITextPointer position, LogicalDirection direction, bool forceEvaluation)
145internal ITextPointer GetNextSpellingErrorPosition(ITextPointer position, LogicalDirection direction)
194ExpandToWordBreakAndContext(error.Start, LogicalDirection.Backward, language, out ITextPointer contentStart, out ITextPointer contextStart);
195ExpandToWordBreakAndContext(error.End, LogicalDirection.Forward, language, out ITextPointer contentEnd, out ITextPointer contextEnd);
240if (_statusTable.GetError(pointer, LogicalDirection.Forward, out errorStart, out errorEnd))
250pointer = _statusTable.GetNextErrorTransition(pointer, LogicalDirection.Forward);
670end = GetNextLanguageTransition(start, LogicalDirection.Forward, language, end);
711wordBreakLeft = SearchForWordBreaks(caretPosition, LogicalDirection.Backward, language, 1, false /* stopOnError */);
712wordBreakRight = SearchForWordBreaks(caretPosition, LogicalDirection.Forward, language, 1, false /* stopOnError */);
727FindPositionInSegmentList(textMap, LogicalDirection.Backward, segments, out leftBreakOffset, out rightBreakOffset);
797ExpandToWordBreakAndContext(start, LogicalDirection.Backward, language, out contentStart, out contextStart);
798ExpandToWordBreakAndContext(end, LogicalDirection.Forward, language, out contentEnd, out contextEnd);
1089private void ExpandToWordBreakAndContext(ITextPointer position, LogicalDirection direction, XmlLanguage language,
1099LogicalDirection inwardDirection;
1125inwardDirection = direction == LogicalDirection.Forward ? LogicalDirection.Backward : LogicalDirection.Forward;
1131if (direction == LogicalDirection.Backward)
1166if (direction == LogicalDirection.Backward)
1183if (direction == LogicalDirection.Backward)
1210if (direction == LogicalDirection.Backward)
1239private int FindPositionInSegmentList(TextMap textMap, LogicalDirection direction, ArrayList segments,
1298if (direction == LogicalDirection.Backward)
1319private ITextPointer SearchForWordBreaks(ITextPointer position, LogicalDirection direction, XmlLanguage language, int minWordCount, bool stopOnError)
1337closestErrorPosition = nextErrorTransition.CreateDynamicTextPointer(LogicalDirection.Forward);
1345searchPosition.MoveByOffset(direction == LogicalDirection.Backward ? -ContextBlockSize : +ContextBlockSize);
1350if (direction == LogicalDirection.Backward && closestErrorPosition.CompareTo(searchPosition) > 0 ||
1351direction == LogicalDirection.Forward && closestErrorPosition.CompareTo(searchPosition) < 0)
1361if (direction == LogicalDirection.Backward && closestLanguageTransition.CompareTo(searchPosition) > 0 ||
1362direction == LogicalDirection.Forward && closestLanguageTransition.CompareTo(searchPosition) < 0)
1368if (direction == LogicalDirection.Backward)
1391private ITextPointer GetNextLanguageTransition(ITextPointer position, LogicalDirection direction, XmlLanguage language, ITextPointer haltPosition)
1395while ((direction == LogicalDirection.Forward && navigator.CompareTo(haltPosition) < 0) ||
1396(direction == LogicalDirection.Backward && navigator.CompareTo(haltPosition) > 0))
1405if ((direction == LogicalDirection.Forward && navigator.CompareTo(haltPosition) > 0) ||
1406(direction == LogicalDirection.Backward && navigator.CompareTo(haltPosition) < 0))
1468private void ScanPosition(ITextPointer position, LogicalDirection direction)
1473if (direction == LogicalDirection.Forward)
1662_basePosition = contextStart.GetFrozenPointer(LogicalDirection.Backward);
1689switch (position.GetPointerContext(LogicalDirection.Forward))
1692runCount = position.GetTextRunLength(LogicalDirection.Forward);
1696position.GetTextInRun(LogicalDirection.Forward, _text, _textLength, runCount);
1732position.MoveToNextContextPosition(LogicalDirection.Forward);
1740position.MoveToNextContextPosition(LogicalDirection.Forward);
1807context = pointer.GetPointerContext(LogicalDirection.Forward);
1810TextSchema.IsFormattingType(pointer.GetElementType(LogicalDirection.Forward)))
System\Windows\Documents\SpellerStatusTable.cs (20)
93for (index = FindIndex(searchStart.CreateStaticPointer(), LogicalDirection.Forward); index >= 0 && index < _runList.Count; index++)
129runIndex = FindIndex(start.CreateStaticPointer(), LogicalDirection.Forward);
165internal bool IsRunType(StaticTextPointer textPosition, LogicalDirection direction, RunType runType)
180internal StaticTextPointer GetNextErrorTransition(StaticTextPointer textPosition, LogicalDirection direction)
195else if (direction == LogicalDirection.Forward)
245internal bool GetError(StaticTextPointer textPosition, LogicalDirection direction,
265internal bool GetRun(StaticTextPointer position, LogicalDirection direction, out RunType runType, out StaticTextPointer end)
280end = (direction == LogicalDirection.Forward) ? GetRunEndPosition(index) : run.Position.CreateStaticPointer();
310private int GetErrorIndex(StaticTextPointer textPosition, LogicalDirection direction)
333private int FindIndex(StaticTextPointer position, LogicalDirection direction)
350if (direction == LogicalDirection.Forward && position.CompareTo(run.Position) < 0 ||
351direction == LogicalDirection.Backward && position.CompareTo(run.Position) <= 0)
356else if (direction == LogicalDirection.Forward && position.CompareTo(GetRunEndPosition(index)) >= 0 ||
357direction == LogicalDirection.Backward && position.CompareTo(GetRunEndPosition(index)) > 0)
393startIndex = FindIndex(start.CreateStaticPointer(), LogicalDirection.Forward);
394endIndex = FindIndex(end.CreateStaticPointer(), LogicalDirection.Backward);
429endIndex = FindIndex(end.CreateStaticPointer(), LogicalDirection.Backward);
594index = FindIndex(position.CreateStaticPointer(), LogicalDirection.Backward);
753return GetRunEndPosition(index).CreateDynamicTextPointer(LogicalDirection.Forward);
801_position = position.GetFrozenPointer(LogicalDirection.Backward);
System\Windows\Documents\TextContainer.cs (36)
434ITextPointer ITextContainer.CreatePointerAtOffset(int offset, LogicalDirection direction)
442internal TextPointer CreatePointerAtOffset(int offset, LogicalDirection direction)
451ITextPointer ITextContainer.CreatePointerAtCharOffset(int charOffset, LogicalDirection direction)
465internal TextPointer CreatePointerAtCharOffset(int charOffset, LogicalDirection direction)
478ITextPointer ITextContainer.CreateDynamicTextPointer(StaticTextPointer position, LogicalDirection direction)
505TextPointerContext ITextContainer.GetPointerContext(StaticTextPointer pointer, LogicalDirection direction)
516else if (direction == LogicalDirection.Forward)
518edge = node.GetEdgeFromOffset(nodeOffset, LogicalDirection.Forward);
523edge = node.GetEdgeFromOffset(nodeOffset, LogicalDirection.Backward);
555int ITextContainer.GetTextInRun(StaticTextPointer position, LogicalDirection direction, char[] textBuffer, int startIndex, int count)
571object ITextContainer.GetAdjacentElement(StaticTextPointer position, LogicalDirection direction)
618StaticTextPointer ITextContainer.GetNextContextPosition(StaticTextPointer position, LogicalDirection direction)
635edge = (direction == LogicalDirection.Backward) ? ElementEdge.AfterStart : ElementEdge.BeforeEnd;
641TextTreeTextNode nextTextNode = ((direction == LogicalDirection.Forward) ? node.GetNextNode() : node.GetPreviousNode()) as TextTreeTextNode;
646edge = (direction == LogicalDirection.Backward) ? ElementEdge.BeforeStart : ElementEdge.AfterEnd;
650else if (direction == LogicalDirection.Forward)
652edge = node.GetEdgeFromOffset(nodeOffset, LogicalDirection.Forward);
657edge = node.GetEdgeFromOffset(nodeOffset, LogicalDirection.Backward);
829LogicalDirection direction;
863originalPosition = this.HasListeners ? new TextPointer(position, LogicalDirection.Backward) : null;
875direction = LogicalDirection.Backward;
879direction = LogicalDirection.Forward;
888if ((direction == LogicalDirection.Backward && textNode.AfterEndReferenceCount) ||
889(direction == LogicalDirection.Forward && textNode.BeforeStartReferenceCount))
1049newFirstIMEVisibleNode = startPosition.GetAdjacentTextElementNodeSibling(LogicalDirection.Forward);
1271deletePosition = new TextPointer(startPosition, LogicalDirection.Forward);
1597if (!_rootNode.CaretUnitBoundaryCache && position.LogicalDirection == LogicalDirection.Backward)
1605TextPointer positionForwardGravity = position.GetPositionAtOffset(0, LogicalDirection.Forward);
1640startPosition = new TextPointer(this, _rootNode, ElementEdge.AfterStart, LogicalDirection.Backward);
1671endPosition = new TextPointer(this, _rootNode, ElementEdge.BeforeEnd, LogicalDirection.Forward);
2437node = startPosition.GetAdjacentSiblingNode(LogicalDirection.Forward);
2438stopNode = endPosition.GetAdjacentSiblingNode(LogicalDirection.Forward);
2793startPosition = new TextPointer(this, elementNode, ElementEdge.BeforeStart, LogicalDirection.Backward);
2798endPosition = new TextPointer(this, elementNode, ElementEdge.AfterEnd, LogicalDirection.Backward);
3422TextElement adjacentElement = startPosition.GetAdjacentElement(LogicalDirection.Forward) as TextElement;
3425nextIMEVisibleNode = (TextTreeTextElementNode)endPosition.GetAdjacentSiblingNode(LogicalDirection.Forward);
System\windows\Documents\TextEditorSelection.cs (91)
128ITextPointer lineStart = position.CreatePointer(LogicalDirection.Forward);
130ITextPointer lineEnd = position.CreatePointer(LogicalDirection.Backward);
203LogicalDirection movementDirection = IsFlowDirectionRightToLeftThenTopToBottom(This) ? LogicalDirection.Backward : LogicalDirection.Forward;
219LogicalDirection movementDirection = IsFlowDirectionRightToLeftThenTopToBottom(This) ? LogicalDirection.Forward : LogicalDirection.Backward;
236LogicalDirection movementDirection = IsFlowDirectionRightToLeftThenTopToBottom(This) ? LogicalDirection.Backward : LogicalDirection.Forward;
252LogicalDirection movementDirection = IsFlowDirectionRightToLeftThenTopToBottom(This) ? LogicalDirection.Forward : LogicalDirection.Backward;
328ITextPointer nextPosition = lineEndPosition.GetNextInsertionPosition(LogicalDirection.Forward);
418ITextPointer previousPosition = lineStartPosition.GetNextInsertionPosition(LogicalDirection.Backward);
479if (movingPointer.MoveToNextInsertionPosition(LogicalDirection.Forward))
483This.Selection.SetCaretToPosition(paragraphRange.Start, LogicalDirection.Backward, /*allowStopAtLineEnd:*/false, /*allowStopNearSpace:*/false);
488This.Selection.SetCaretToPosition(paragraphRange.End, LogicalDirection.Backward, /*allowStopAtLineEnd:*/false, /*allowStopNearSpace:*/false);
532This.Selection.SetCaretToPosition(paragraphRange.Start, LogicalDirection.Backward, /*allowStopAtLineEnd:*/false, /*allowStopNearSpace:*/false);
537if (movingPointer.MoveToNextInsertionPosition(LogicalDirection.Backward))
541This.Selection.SetCaretToPosition(paragraphRange.Start, LogicalDirection.Backward, /*allowStopAtLineEnd:*/false, /*allowStopNearSpace:*/false);
818ITextPointer caretPosition = lineRange.Start.GetFrozenPointer(LogicalDirection.Forward);
821This.Selection.SetCaretToPosition(caretPosition, LogicalDirection.Forward, /*allowStopAtLineEnd:*/true, /*allowStopNearSpace:*/true);
867LogicalDirection orientation = TextPointerBase.IsNextToPlainLineBreak(lineRange.End, LogicalDirection.Backward) ? LogicalDirection.Forward : LogicalDirection.Backward;
901This.Selection.SetCaretToPosition(This.TextContainer.Start, LogicalDirection.Forward, /*allowStopAtLineEnd:*/false, /*allowStopNearSpace:*/false);
930This.Selection.SetCaretToPosition(This.TextContainer.End, LogicalDirection.Backward, /*allowStopAtLineEnd:*/false, /*allowStopNearSpace:*/false);
961LogicalDirection movementDirection = IsFlowDirectionRightToLeftThenTopToBottom(This) ? LogicalDirection.Backward : LogicalDirection.Forward;
977LogicalDirection movementDirection = IsFlowDirectionRightToLeftThenTopToBottom(This) ? LogicalDirection.Forward : LogicalDirection.Backward;
993LogicalDirection movementDirection = IsFlowDirectionRightToLeftThenTopToBottom(This) ? LogicalDirection.Backward : LogicalDirection.Forward;
1009LogicalDirection movementDirection = IsFlowDirectionRightToLeftThenTopToBottom(This) ? LogicalDirection.Forward : LogicalDirection.Backward;
1027if (This.Selection.ExtendToNextTableRow(LogicalDirection.Forward))
1085ITextPointer nextPosition = lineEndPosition.GetNextInsertionPosition(LogicalDirection.Forward);
1137if (TextPointerBase.IsNextToAnyBreak(newMovingPosition, LogicalDirection.Forward) ||
1138newMovingPosition.GetNextInsertionPosition(LogicalDirection.Forward) == null)
1147newMovingPosition = newMovingPosition.GetInsertionPosition(LogicalDirection.Forward);
1148newMovingPosition = newMovingPosition.GetNextInsertionPosition(LogicalDirection.Forward);
1157newMovingPosition = newMovingPosition.GetFrozenPointer(LogicalDirection.Backward);
1175if (newMovingPosition.GetNextInsertionPosition(LogicalDirection.Forward) == null)
1199if (This.Selection.ExtendToNextTableRow(LogicalDirection.Backward))
1275ITextPointer previousPosition = lineStartPosition.GetNextInsertionPosition(LogicalDirection.Backward);
1336if (movingPointer.MoveToNextInsertionPosition(LogicalDirection.Forward))
1384if (movingPointer.MoveToNextInsertionPosition(LogicalDirection.Backward))
1618ExtendSelectionAndBringIntoView(lineRange.Start.CreatePointer(LogicalDirection.Forward), This);
1670if (TextPointerBase.IsNextToPlainLineBreak(destination, LogicalDirection.Forward) ||
1671TextPointerBase.IsNextToRichLineBreak(destination, LogicalDirection.Forward))
1680destination = destination.GetNextInsertionPosition(LogicalDirection.Forward);
1684else if (TextPointerBase.IsNextToParagraphBreak(destination, LogicalDirection.Forward) &&
1685TextPointerBase.IsNextToParagraphBreak(This.Selection.AnchorPosition, LogicalDirection.Backward))
1689ITextPointer newDestination = destination.GetNextInsertionPosition(LogicalDirection.Forward);
1703destination = destination.GetFrozenPointer(LogicalDirection.Backward);
2052private static void MoveToCharacterLogicalDirection(TextEditor textEditor, LogicalDirection direction, bool extend)
2072ITextPointer movingEnd = (direction == LogicalDirection.Forward ? textEditor.Selection.End : textEditor.Selection.Start);
2082LogicalDirection contentDirection = direction == LogicalDirection.Forward ? LogicalDirection.Backward : LogicalDirection.Forward;
2113private static void NavigateWordLogicalDirection(TextEditor textEditor, LogicalDirection direction)
2130if (direction == LogicalDirection.Forward)
2133if (!textEditor.Selection.IsEmpty && TextPointerBase.IsAtWordBoundary(textEditor.Selection.End, LogicalDirection.Forward))
2136textEditor.Selection.SetCaretToPosition(textEditor.Selection.End, LogicalDirection.Backward, /*allowStopAtLineEnd:*/false, /*allowStopNearSpace:*/false);
2143TextPointerBase.MoveToNextWordBoundary(wordBoundary, LogicalDirection.Forward);
2145textEditor.Selection.SetCaretToPosition(wordBoundary, LogicalDirection.Backward, /*allowStopAtLineEnd:*/false, /*allowStopNearSpace:*/false);
2153if (!textEditor.Selection.IsEmpty && TextPointerBase.IsAtWordBoundary(textEditor.Selection.Start, LogicalDirection.Forward))
2156textEditor.Selection.SetCaretToPosition(textEditor.Selection.Start, LogicalDirection.Forward, /*allowStopAtLineEnd:*/false, /*allowStopNearSpace:*/false);
2163TextPointerBase.MoveToNextWordBoundary(wordBoundary, LogicalDirection.Backward);
2165textEditor.Selection.SetCaretToPosition(wordBoundary, LogicalDirection.Forward, /*allowStopAtLineEnd:*/false, /*allowStopNearSpace:*/false);
2188private static void ExtendWordLogicalDirection(TextEditor textEditor, LogicalDirection direction)
2209wordBoundary.SetLogicalDirection(direction == LogicalDirection.Forward ? LogicalDirection.Backward : LogicalDirection.Forward);
2321movingPosition.LogicalDirection == LogicalDirection.Backward &&
2323TextPointerBase.IsNextToAnyBreak(movingPosition, LogicalDirection.Backward))
2325movingPosition = movingPosition.GetNextInsertionPosition(LogicalDirection.Backward);
2329if (TextPointerBase.IsNextToPlainLineBreak(movingPosition, LogicalDirection.Backward))
2331movingPosition = movingPosition.GetFrozenPointer(LogicalDirection.Forward);
2348return This.Selection.IsEmpty ? This.Selection.Start : This.Selection.Start.GetFrozenPointer(LogicalDirection.Forward);
2411ITextPointer position = This.Selection.Start.GetNextInsertionPosition(LogicalDirection.Backward);
2414This.Selection.SetCaretToPosition(position, LogicalDirection.Forward, /*allowStopAtLineEnd:*/false, /*allowStopNearSpace:*/false);
2427ITextPointer cellEnd = position.GetNextInsertionPosition(LogicalDirection.Backward);
System\windows\Documents\TextEditorSpelling.cs (22)
37internal static SpellingError GetSpellingErrorAtPosition(TextEditor This, ITextPointer position, LogicalDirection direction)
60LogicalDirection direction = This.Selection.IsEmpty ? This.Selection.Start.LogicalDirection : LogicalDirection.Forward;
68direction = (direction == LogicalDirection.Forward) ? LogicalDirection.Backward : LogicalDirection.Forward;
83direction = (direction == LogicalDirection.Forward) ? LogicalDirection.Backward : LogicalDirection.Forward;
88direction = LogicalDirection.Forward;
92direction = LogicalDirection.Backward;
102internal static ITextPointer GetNextSpellingErrorPosition(TextEditor This, ITextPointer position, LogicalDirection direction)
149caretPosition = textStart.CreatePointer(+correctedText.Length, LogicalDirection.Forward);
185textStart = spellingError.Start.CreatePointer(LogicalDirection.Backward);
187textStart.GetPointerContext(LogicalDirection.Forward) != TextPointerContext.Text)
189textStart.MoveToNextContextPosition(LogicalDirection.Forward);
193textEnd.GetPointerContext(LogicalDirection.Backward) != TextPointerContext.Text)
195textEnd.MoveToNextContextPosition(LogicalDirection.Backward);
198if (textStart.GetPointerContext(LogicalDirection.Forward) != TextPointerContext.Text ||
203Invariant.Assert(textEnd.GetPointerContext(LogicalDirection.Backward) == TextPointerContext.Text &&
254private static ITextPointer GetNextTextPosition(ITextPointer position, ITextPointer limit, LogicalDirection direction, out char character)
317position = GetNextTextPosition(position, limit, LogicalDirection.Forward, out character);
System\windows\Documents\TextEditorTyping.cs (36)
552ITextPointer deletePosition = position.GetNextInsertionPosition(LogicalDirection.Forward);
575This.Selection.ExtendToNextInsertionPosition(LogicalDirection.Forward);
629ITextPointer deletePosition = position.GetNextInsertionPosition(LogicalDirection.Backward);
654position = position.GetFrozenPointer(LogicalDirection.Backward);
661position.GetPointerContext(LogicalDirection.Backward) == TextPointerContext.Text)
683This.Selection.ExtendToNextInsertionPosition(LogicalDirection.Backward);
691else if (backspacePosition.GetPointerContext(LogicalDirection.Backward) != TextPointerContext.Text)
700This.Selection.ExtendToNextInsertionPosition(LogicalDirection.Backward);
732This.Selection.SetCaretToPosition(position, LogicalDirection.Backward, /*allowStopAtLineEnd:*/false, /*allowStopNearSpace:*/true);
748LogicalDirection directionOfDelete = position.CompareTo(deletePosition) < 0 ? LogicalDirection.Forward : LogicalDirection.Backward;
755if (directionOfDelete == LogicalDirection.Forward)
782if (directionOfDelete == LogicalDirection.Backward)
819position.GetPointerContext(LogicalDirection.Backward) == TextPointerContext.ElementStart &&
820position.GetPointerContext(LogicalDirection.Forward) == TextPointerContext.ElementEnd)
825while (position.GetPointerContext(LogicalDirection.Backward) == TextPointerContext.ElementStart)
832position = position.GetNextContextPosition(LogicalDirection.Backward);
833if (position.GetPointerContext(LogicalDirection.Backward) == TextPointerContext.ElementStart &&
841position = position.GetNextContextPosition(LogicalDirection.Backward);
852if (position.GetPointerContext(LogicalDirection.Backward) != TextPointerContext.ElementStart)
858position.GetPointerContext(LogicalDirection.Forward) != TextPointerContext.ElementEnd)
866while (navigator.GetPointerContext(LogicalDirection.Backward) == TextPointerContext.ElementStart &&
873if (!(navigator.GetPointerContext(LogicalDirection.Backward) == TextPointerContext.ElementStart &&
922TextPointerBase.MoveToNextWordBoundary(wordBoundary, LogicalDirection.Forward);
981TextPointerBase.MoveToNextWordBoundary(wordBoundary, LogicalDirection.Backward);
1090This.Selection.SetCaretToPosition(This.Selection.End, LogicalDirection.Forward, /*allowStopAtLineEnd:*/false, /*allowStopNearSpace:*/false);
1181This.Selection.SetCaretToPosition(range.Start, LogicalDirection.Forward, /*allowStopAtLineEnd:*/false, /*allowStopNearSpace:*/false);
1353if (HandleTabInTables(This, LogicalDirection.Forward))
1385if (HandleTabInTables(This, LogicalDirection.Backward))
1406private static bool HandleTabInTables(TextEditor This, LogicalDirection direction)
1417This.Selection.SetCaretToPosition(This.Selection.Start, LogicalDirection.Backward, /*allowStopAtLineEnd:*/false, /*allowStopNearSpace:*/false);
1430if (direction == LogicalDirection.Forward)
1467if (direction == LogicalDirection.Forward)
1565ITextPointer caretPosition = This.Selection.End.CreatePointer(LogicalDirection.Backward);
1568This.Selection.SetCaretToPosition(caretPosition, LogicalDirection.Backward, /*allowStopAtLineEnd:*/true, /*allowStopNearSpace:*/true);
System\Windows\Documents\TextElement.cs (7)
303TextPointer contentStart = new TextPointer(tree, _textElementNode, ElementEdge.AfterStart, LogicalDirection.Backward);
306TextPointer contentEnd = new TextPointer(tree, _textElementNode, ElementEdge.BeforeEnd, LogicalDirection.Forward);
329elementStart = new TextPointer(tree, _textElementNode, ElementEdge.BeforeStart, LogicalDirection.Forward);
362contentStart = new TextPointer(tree, _textElementNode, ElementEdge.AfterStart, LogicalDirection.Backward);
395contentEnd = new TextPointer(tree, _textElementNode, ElementEdge.BeforeEnd, LogicalDirection.Forward);
436elementEnd = new TextPointer(tree, _textElementNode, ElementEdge.AfterEnd, LogicalDirection.Backward);
1009beforeStart = new TextPointer(tree, _textElementNode, ElementEdge.BeforeStart, LogicalDirection.Forward);
System\Windows\Documents\TextPointer.cs (97)
276internal TextPointer(TextPointer position, LogicalDirection direction)
282internal TextPointer(TextPointer position, int offset, LogicalDirection direction)
288internal TextPointer(TextContainer textContainer, int offset, LogicalDirection direction)
306Initialize(tree, node, edge, LogicalDirection.Forward, tree.PositionGeneration, false, false, tree.LayoutGeneration);
310internal TextPointer(TextContainer tree, TextTreeNode node, ElementEdge edge, LogicalDirection direction)
322internal TextPointer CreatePointer(LogicalDirection gravity)
501/// is <see cref="System.Windows.Documents.LogicalDirection.Backward"/>, or if it is positioned
503/// <see cref="System.Windows.Documents.LogicalDirection.Forward"/>.</para>
544public TextPointerContext GetPointerContext(LogicalDirection direction)
552return (direction == LogicalDirection.Forward) ? GetPointerContextForward(_node, this.Edge) : GetPointerContextBackward(_node, this.Edge);
566public int GetTextRunLength(LogicalDirection direction)
587if (direction == LogicalDirection.Forward)
603textNode = ((direction == LogicalDirection.Forward) ? textNode.GetNextNode() : textNode.GetPreviousNode()) as TextTreeTextNode;
737public string GetTextInRun(LogicalDirection direction)
775public int GetTextInRun(LogicalDirection direction, char[] textBuffer, int startIndex, int count)
809public DependencyObject GetAdjacentElement(LogicalDirection direction)
902public TextPointer GetPositionAtOffset(int offset, LogicalDirection direction)
990public TextPointer GetNextContextPosition(LogicalDirection direction)
1063public TextPointer GetInsertionPosition(LogicalDirection direction)
1071return GetInsertionPosition(LogicalDirection.Forward);
1090/// "insertion position" in the <see cref="TextPointer.GetInsertionPosition(LogicalDirection)"/>
1130public TextPointer GetNextInsertionPosition(LogicalDirection direction)
1227position.SetLogicalDirection(LogicalDirection.Forward);
1248public Rect GetCharacterRect(LogicalDirection direction)
1330LogicalDirection direction = count < 0 ? LogicalDirection.Backward : LogicalDirection.Forward;
1535public LogicalDirection LogicalDirection
1615TextPointerContext backwardContext = position.GetPointerContext(LogicalDirection.Backward);
1619TextSchema.IsFormattingType(position.GetAdjacentElement(LogicalDirection.Backward).GetType()))
1621position.MoveToNextContextPosition(LogicalDirection.Backward);
1622backwardContext = position.GetPointerContext(LogicalDirection.Backward);
1750internal static int GetTextInRun(TextContainer textContainer, int symbolOffset, TextTreeTextNode textNode, int nodeOffset, LogicalDirection direction, char[] textBuffer, int startIndex, int count)
1782skipCount = (direction == LogicalDirection.Forward) ? nodeOffset : textNode.SymbolCount - nodeOffset;
1799textNode = ((direction == LogicalDirection.Forward) ? textNode.GetNextNode() : textNode.GetPreviousNode()) as TextTreeTextNode;
1803if (direction == LogicalDirection.Backward)
1816internal static DependencyObject GetAdjacentElement(TextTreeNode node, ElementEdge edge, LogicalDirection direction)
1972internal bool MoveToNextContextPosition(LogicalDirection direction)
1985if (direction == LogicalDirection.Forward)
2032internal bool MoveToInsertionPosition(LogicalDirection direction)
2075internal bool MoveToNextInsertionPosition(LogicalDirection direction)
2168internal TextElement GetAdjacentElementFromOuterPosition(LogicalDirection direction)
2186internal void SetLogicalDirection(LogicalDirection direction)
2339internal TextPointer GetFrozenPointer(LogicalDirection logicalDirection)
2348void ITextPointer.SetLogicalDirection(LogicalDirection direction)
2388TextPointerContext ITextPointer.GetPointerContext(LogicalDirection direction)
2393int ITextPointer.GetTextRunLength(LogicalDirection direction)
2399string ITextPointer.GetTextInRun(LogicalDirection direction)
2404int ITextPointer.GetTextInRun(LogicalDirection direction, char[] textBuffer, int startIndex, int count)
2409object ITextPointer.GetAdjacentElement(LogicalDirection direction)
2414Type ITextPointer.GetElementType(LogicalDirection direction)
2451ITextPointer ITextPointer.GetNextContextPosition(LogicalDirection direction)
2466ITextPointer ITextPointer.GetInsertionPosition(LogicalDirection direction)
2477ITextPointer ITextPointer.GetFormatNormalizedPosition(LogicalDirection direction)
2486ITextPointer ITextPointer.GetNextInsertionPosition(LogicalDirection direction)
2580ITextPointer ITextPointer.CreatePointer(LogicalDirection gravity)
2585ITextPointer ITextPointer.CreatePointer(int offset, LogicalDirection gravity)
2596ITextPointer ITextPointer.GetFrozenPointer(LogicalDirection logicalDirection)
2602bool ITextPointer.MoveToNextContextPosition(LogicalDirection direction)
2659Rect ITextPointer.GetCharacterRect(LogicalDirection direction)
2664bool ITextPointer.MoveToInsertionPosition(LogicalDirection direction)
2669bool ITextPointer.MoveToNextInsertionPosition(LogicalDirection direction)
2679internal bool MoveToCaretPosition(LogicalDirection contentDirection)
2682LogicalDirection oppositeDirection;
2703oppositeDirection = (contentDirection == LogicalDirection.Forward) ? LogicalDirection.Backward : LogicalDirection.Forward;
2714internal bool MoveToNextCaretPosition(LogicalDirection direction)
2815internal TextTreeTextNode GetAdjacentTextNodeSibling(LogicalDirection direction)
2822internal static TextTreeTextNode GetAdjacentTextNodeSibling(TextTreeNode node, ElementEdge edge, LogicalDirection direction)
2829internal TextTreeTextElementNode GetAdjacentTextElementNodeSibling(LogicalDirection direction)
2836internal TextTreeTextElementNode GetAdjacentTextElementNode(LogicalDirection direction)
2843internal TextTreeNode GetAdjacentSiblingNode(LogicalDirection direction)
2850internal static TextTreeNode GetAdjacentSiblingNode(TextTreeNode node, ElementEdge edge, LogicalDirection direction)
2854if (direction == LogicalDirection.Forward)
3010if (GetGravityInternal() == LogicalDirection.Forward)
3441symbolType = node.GetPointerContext(LogicalDirection.Forward);
3448symbolType = firstContainedNode.GetPointerContext(LogicalDirection.Forward);
3466symbolType = nextNode.GetPointerContext(LogicalDirection.Forward);
3498symbolType = previousNode.GetPointerContext(LogicalDirection.Backward);
3518symbolType = lastChildNode.GetPointerContext(LogicalDirection.Backward);
3527symbolType = node.GetPointerContext(LogicalDirection.Backward);
3678LogicalDirection ITextPointer.LogicalDirection
3893private void InitializeOffset(TextPointer position, int distance, LogicalDirection direction)
3930private void Initialize(TextContainer tree, TextTreeNode node, ElementEdge edge, LogicalDirection gravity, uint generation,
3990private static void RepositionForGravity(ref TextTreeNode node, ref ElementEdge edge, LogicalDirection gravity)
4001if (gravity == LogicalDirection.Backward)
4014if (gravity == LogicalDirection.Forward)
4027if (gravity == LogicalDirection.Backward)
4040if (gravity == LogicalDirection.Forward)
4058private LogicalDirection GetGravityInternal()
4060return (this.Edge == ElementEdge.BeforeStart || this.Edge == ElementEdge.BeforeEnd) ? LogicalDirection.Forward : LogicalDirection.Backward;
4073internal TextTreeNode GetAdjacentNode(LogicalDirection direction)
4078internal static TextTreeNode GetAdjacentNode(TextTreeNode node, ElementEdge edge, LogicalDirection direction)
4122private TextElement GetElement(LogicalDirection direction)
4141if (GetGravityInternal() == LogicalDirection.Forward)
System\Windows\Documents\TextPointerBase.cs (111)
58internal static string GetTextInRun(ITextPointer position, LogicalDirection direction)
76internal static int GetTextWithLimit(ITextPointer thisPointer, LogicalDirection direction, char[] textBuffer, int startIndex, int count, ITextPointer limit)
85else if (direction == LogicalDirection.Forward && limit.CompareTo(thisPointer) <= 0)
90else if (direction == LogicalDirection.Backward && limit.CompareTo(thisPointer) >= 0)
102if (direction == LogicalDirection.Forward)
184Type forwardType = forwardPosition.GetElementType(LogicalDirection.Forward);
185Type backwardType = backwardPosition.GetElementType(LogicalDirection.Backward);
188TextPointerContext forwardContext = forwardPosition.GetPointerContext(LogicalDirection.Forward);
189TextPointerContext backwardContext = backwardPosition.GetPointerContext(LogicalDirection.Backward);
230TextPointerContext backwardContext = position.GetPointerContext(LogicalDirection.Backward);
231TextPointerContext forwardContext = position.GetPointerContext(LogicalDirection.Forward);
254TextPointerContext forwardContext = position.GetPointerContext(LogicalDirection.Forward);
255TextPointerContext backwardContext = position.GetPointerContext(LogicalDirection.Backward);
259typeof(Table).IsAssignableFrom(position.GetElementType(LogicalDirection.Forward)));
272position.GetPointerContext(LogicalDirection.Backward) == TextPointerContext.ElementStart;
278position.GetPointerContext(LogicalDirection.Forward) == TextPointerContext.ElementEnd;
323BorderingElementCategory category = GetBorderingElementCategory(navigator, LogicalDirection.Forward);
330navigator.MoveToNextContextPosition(LogicalDirection.Forward);
332while (GetBorderingElementCategory(navigator, LogicalDirection.Forward) == BorderingElementCategory.MergeableScopingInline);
338elementType = navigator.GetElementType(LogicalDirection.Forward);
342navigator.MoveToNextContextPosition(LogicalDirection.Forward);
359elementType = navigator.GetElementType(LogicalDirection.Forward);
362navigator.MoveToNextInsertionPosition(LogicalDirection.Forward);
375navigator.MoveToNextContextPosition(LogicalDirection.Forward);
377while (navigator.GetPointerContext(LogicalDirection.Forward) == TextPointerContext.ElementStart);
388return IsAtNonMergeableInlineEdge(position, LogicalDirection.Backward);
394return IsAtNonMergeableInlineEdge(position, LogicalDirection.Forward);
404internal static bool IsAtFormatNormalizedPosition(ITextPointer position, LogicalDirection direction)
409internal static bool IsAtInsertionPosition(ITextPointer position, LogicalDirection direction)
414internal static bool IsAtNormalizedPosition(ITextPointer position, LogicalDirection direction, bool respectCaretUnitBoundaries)
423if (position.GetPointerContext(LogicalDirection.Backward) == TextPointerContext.ElementStart &&
424position.GetPointerContext(LogicalDirection.Forward) == TextPointerContext.ElementEnd)
469internal static bool IsAtWordBoundary(ITextPointer thisPosition, LogicalDirection insideWordDirection)
512return GetWordRange(thisPosition, LogicalDirection.Forward);
524internal static TextSegment GetWordRange(ITextPointer thisPosition, LogicalDirection direction)
547if (moved && IsAtWordBoundary(thisPosition, /*insideWordDirection:*/LogicalDirection.Forward))
554MoveToNextWordBoundary(navigator, direction == LogicalDirection.Backward ? LogicalDirection.Forward : LogicalDirection.Backward);
558if (direction == LogicalDirection.Backward)
567wordStart = RestrictWithinBlock(thisPosition, wordStart, LogicalDirection.Backward);
568wordEnd = RestrictWithinBlock(thisPosition, wordEnd, LogicalDirection.Forward);
573wordStart = wordStart.GetFrozenPointer(LogicalDirection.Backward);
574wordEnd = wordEnd.GetFrozenPointer(LogicalDirection.Forward);
578wordStart = wordEnd.GetFrozenPointer(LogicalDirection.Backward);
586private static ITextPointer RestrictWithinBlock(ITextPointer position, ITextPointer limit, LogicalDirection direction)
588Invariant.Assert(!(direction == LogicalDirection.Backward) || position.CompareTo(limit) >= 0, "for backward direction position must be >= than limit");
589Invariant.Assert(!(direction == LogicalDirection.Forward) || position.CompareTo(limit) <= 0, "for forward direcion position must be <= than linit");
591while (direction == LogicalDirection.Backward ? position.CompareTo(limit) > 0 : position.CompareTo(limit) < 0)
612return limit.GetInsertionPosition(direction == LogicalDirection.Backward ? LogicalDirection.Forward : LogicalDirection.Backward);
621internal static bool IsNextToPlainLineBreak(ITextPointer thisPosition, LogicalDirection direction)
631(direction == LogicalDirection.Backward && IsCharUnicodeNewLine(textBuffer[1]))
633(direction == LogicalDirection.Forward && IsCharUnicodeNewLine(textBuffer[0]))
649internal static bool IsNextToRichLineBreak(ITextPointer thisPosition, LogicalDirection direction)
658internal static bool IsNextToParagraphBreak(ITextPointer thisPosition, LogicalDirection direction)
669internal static bool IsNextToAnyBreak(ITextPointer thisPosition, LogicalDirection direction)
699bool isAtLineWrappingPosition = position.LogicalDirection == LogicalDirection.Forward
714thisPosition.GetPointerContext(LogicalDirection.Forward) == TextPointerContext.ElementEnd &&
715thisPosition.GetPointerContext(LogicalDirection.Backward) != TextPointerContext.ElementStart;
725return thisPosition.GetPointerContext(LogicalDirection.Forward) == TextPointerContext.None &&
726thisPosition.GetPointerContext(LogicalDirection.Backward) == TextPointerContext.ElementEnd &&
727!typeof(Inline).IsAssignableFrom(thisPosition.GetElementType(LogicalDirection.Backward));
741while (pointer.GetPointerContext(LogicalDirection.Backward) == TextPointerContext.ElementStart)
747pointer = pointer.GetNextContextPosition(LogicalDirection.Backward);
779paragraphOrBlockUIContainer.ElementStart.GetPointerContext(LogicalDirection.Backward) == TextPointerContext.ElementStart)
856internal static Rect GetCharacterRect(ITextPointer thisPointer, LogicalDirection direction)
862internal static Rect GetCharacterRect(ITextPointer thisPointer, LogicalDirection direction, bool transformToUiScope)
923internal static bool MoveToFormatNormalizedPosition(ITextPointer thisNavigator, LogicalDirection direction)
936internal static bool MoveToInsertionPosition(ITextPointer thisNavigator, LogicalDirection direction)
959internal static bool MoveToNextInsertionPosition(ITextPointer thisNavigator, LogicalDirection direction)
965int increment = direction == LogicalDirection.Forward ? +1 : -1;
982if ((direction == LogicalDirection.Forward && initialPosition.CompareTo(thisNavigator) < 0) ||
983(direction == LogicalDirection.Backward && thisNavigator.CompareTo(initialPosition) < 0))
1013if (direction == LogicalDirection.Backward)
1026while (TextSchema.IsFormattingType(thisNavigator.GetElementType(LogicalDirection.Forward))
1037if (direction == LogicalDirection.Forward)
1067internal static bool MoveToNextWordBoundary(ITextPointer thisNavigator, LogicalDirection movingDirection)
1088if (IsAtWordBoundary(thisNavigator, /*insideWordDirection:*/LogicalDirection.Forward))
1099internal static ITextPointer GetFrozenPointer(ITextPointer thisPointer, LogicalDirection logicalDirection)
1138private static bool NormalizePosition(ITextPointer thisNavigator, LogicalDirection direction, bool respectCaretUnitBoundaries)
1144LogicalDirection oppositeDirection;
1148if (direction == LogicalDirection.Forward)
1151oppositeDirection = LogicalDirection.Backward;
1158oppositeDirection = LogicalDirection.Forward;
1254private static int LeaveNonMergeableInlineBoundary(ITextPointer thisNavigator, LogicalDirection direction, int symbolCount)
1258if (direction == LogicalDirection.Forward && IsAtNonMergeableInlineEnd(thisNavigator))
1260symbolCount += LeaveNonMergeableAncestor(thisNavigator, LogicalDirection.Forward);
1264symbolCount += LeaveNonMergeableAncestor(thisNavigator, LogicalDirection.Backward);
1269if (direction == LogicalDirection.Backward && IsAtNonMergeableInlineStart(thisNavigator))
1271symbolCount += LeaveNonMergeableAncestor(thisNavigator, LogicalDirection.Backward);
1275symbolCount += LeaveNonMergeableAncestor(thisNavigator, LogicalDirection.Forward);
1283private static int LeaveNonMergeableAncestor(ITextPointer thisNavigator, LogicalDirection direction)
1286int increment = (direction == LogicalDirection.Forward) ? +1 : -1;
1331TextPointerContext forwardContext = position.GetPointerContext(LogicalDirection.Forward);
1332TextPointerContext backwardContext = position.GetPointerContext(LogicalDirection.Backward);
1367if (position.GetTextInRun(LogicalDirection.Backward, neighborhood, 0, 1) == 1 &&
1368position.GetTextInRun(LogicalDirection.Forward, neighborhood, 1, 1) == 1)
1426runLength = Math.Min(navigator.GetTextRunLength(LogicalDirection.Backward), SelectionWordBreaker.MinContextLength - preceedingCount);
1430navigator.GetTextInRun(LogicalDirection.Forward, preceedingText, SelectionWordBreaker.MinContextLength - preceedingCount, runLength);
1436navigator.MoveToInsertionPosition(LogicalDirection.Backward);
1438while (navigator.GetPointerContext(LogicalDirection.Backward) == TextPointerContext.Text);
1445runLength = Math.Min(navigator.GetTextRunLength(LogicalDirection.Forward), SelectionWordBreaker.MinContextLength - followingCount);
1447navigator.GetTextInRun(LogicalDirection.Forward, followingText, followingCount, runLength);
1456navigator.MoveToInsertionPosition(LogicalDirection.Forward);
1458while (navigator.GetPointerContext(LogicalDirection.Forward) == TextPointerContext.Text);
1469private static bool IsAtNonMergeableInlineEdge(ITextPointer position, LogicalDirection direction)
1489private static BorderingElementCategory GetBorderingElementCategory(ITextPointer position, LogicalDirection direction)
1491TextPointerContext context = (direction == LogicalDirection.Forward) ? TextPointerContext.ElementEnd : TextPointerContext.ElementStart;
1515private static bool IsNextToRichBreak(ITextPointer thisPosition, LogicalDirection direction, Type lineBreakType)
System\Windows\Documents\TextRangeBase.cs (68)
77textPointer = textPointer.GetFormatNormalizedPosition(LogicalDirection.Forward);
81textPointer = textPointer.GetFormatNormalizedPosition(LogicalDirection.Backward);
195normalizedPosition.MoveToInsertionPosition(LogicalDirection.Backward);
210!TextPointerBase.IsAtWordBoundary(thisRange.Start, LogicalDirection.Forward) && //
211!TextPointerBase.IsAtWordBoundary(thisRange.Start, LogicalDirection.Backward))
286!TextPointerBase.IsNextToAnyBreak(thisRange.End, LogicalDirection.Forward))
292nextPosition.MoveToNextInsertionPosition(LogicalDirection.Forward);
305(TextPointerBase.IsNextToAnyBreak(thisRange.End, LogicalDirection.Backward) ||
308ITextPointer newEnd = thisRange.End.GetNextInsertionPosition(LogicalDirection.Backward);
336SkipParagraphContent(start, LogicalDirection.Backward);
337SkipParagraphContent(end, LogicalDirection.Forward);
344private static void SkipParagraphContent(ITextPointer navigator, LogicalDirection direction)
353(nextContext == TextPointerContext.ElementStart && direction == LogicalDirection.Forward || //
354nextContext == TextPointerContext.ElementEnd && direction == LogicalDirection.Backward) && //
358(nextContext == TextPointerContext.ElementEnd && direction == LogicalDirection.Forward || //
359nextContext == TextPointerContext.ElementStart && direction == LogicalDirection.Backward) && //
414if (position.GetPointerContext(LogicalDirection.Forward) == TextPointerContext.Text)
416moved = position.MoveToNextContextPosition(LogicalDirection.Forward);
420moved = position.MoveToInsertionPosition(LogicalDirection.Forward);
425moved = position.MoveToNextInsertionPosition(LogicalDirection.Forward);
475position.MoveToNextContextPosition(LogicalDirection.Backward)) ;
496moved = position.MoveToNextContextPosition(LogicalDirection.Forward);
519endNavigator.MoveToInsertionPosition(LogicalDirection.Backward);
681TextPointerContext symbolType = navigator.GetPointerContext(LogicalDirection.Forward);
697navigator.MoveToNextContextPosition(LogicalDirection.Forward);
707navigator.MoveToNextContextPosition(LogicalDirection.Forward);
712navigator.MoveToNextContextPosition(LogicalDirection.Forward);
715elementType = navigator.GetElementType(LogicalDirection.Forward);
735navigator.MoveToNextContextPosition(LogicalDirection.Forward);
751int runLength = navigator.GetTextRunLength(LogicalDirection.Forward);
753runLength = TextPointerBase.GetTextWithLimit(navigator, LogicalDirection.Forward, charArray, 0, runLength, endPosition);
755navigator.MoveToNextContextPosition(LogicalDirection.Forward);
765bool theParagraphIsTheFirstInCollection = navigator.GetPointerContext(LogicalDirection.Backward) == TextPointerContext.ElementStart;
766navigator.MoveToNextContextPosition(LogicalDirection.Forward);
768TextPointerContext symbolType = navigator.GetPointerContext(LogicalDirection.Forward);
775navigator.MoveToNextContextPosition(LogicalDirection.Forward);
776symbolType = navigator.GetPointerContext(LogicalDirection.Forward);
799List list = (List)navigator.GetAdjacentElement(LogicalDirection.Forward);
820navigator.MoveToNextContextPosition(LogicalDirection.Forward);
830ListItem listItem = (ListItem)navigator.GetAdjacentElement(LogicalDirection.Forward);
862object element = navigator.GetAdjacentElement(LogicalDirection.Forward);
1254while (start.GetPointerContext(LogicalDirection.Backward) == TextPointerContext.ElementStart &&
1258start = start.GetNextContextPosition(LogicalDirection.Backward);
1314if (thisRange.Start.GetPointerContext(LogicalDirection.Backward) == TextPointerContext.Text &&
1315thisRange.End.GetPointerContext(LogicalDirection.Forward) == TextPointerContext.Text)
1361(insertPosition.GetPointerContext(LogicalDirection.Backward) == TextPointerContext.None ||
1362insertPosition.GetPointerContext(LogicalDirection.Backward) == TextPointerContext.ElementStart) &&
1363(insertPosition.GetPointerContext(LogicalDirection.Forward) == TextPointerContext.None ||
1364insertPosition.GetPointerContext(LogicalDirection.Forward) == TextPointerContext.ElementEnd);
1375ITextPointer newStart = insertPosition.GetFrozenPointer(LogicalDirection.Backward);
1376ITextPointer newEnd = insertPosition.CreatePointer(LogicalDirection.Forward);
1381TextPointer insertionPosition = (TextPointer)newStart.CreatePointer(LogicalDirection.Forward);
1419newEnd = newEnd.GetNextInsertionPosition(LogicalDirection.Forward);
1620TextPointerContext context = start.GetPointerContext(LogicalDirection.Forward);
1623start.MoveToNextContextPosition(LogicalDirection.Forward);
1624context = start.GetPointerContext(LogicalDirection.Forward);
1629context = end.GetPointerContext(LogicalDirection.Backward);
1632end.MoveToNextContextPosition(LogicalDirection.Backward);
1633context = end.GetPointerContext(LogicalDirection.Backward);
1637return start.GetAdjacentElement(LogicalDirection.Forward) as UIElement;
1718start = GetNormalizedPosition(thisRange, start, LogicalDirection.Forward);
1725end = GetNormalizedPosition(thisRange, end, LogicalDirection.Backward);
1732if (start.LogicalDirection == LogicalDirection.Backward)
1735start = end.GetFrozenPointer(LogicalDirection.Backward);
1787private static bool IsAtNormalizedPosition(ITextRange thisRange, ITextPointer position, LogicalDirection direction)
1803private static ITextPointer GetNormalizedPosition(ITextRange thisRange, ITextPointer position, LogicalDirection direction)
1961!TextPointerBase.IsAtInsertionPosition(start, LogicalDirection.Forward) ||
1962!TextPointerBase.IsAtInsertionPosition(end, LogicalDirection.Backward))
System\Windows\Documents\TextRangeSerialization.cs (54)
82range.End.GetPointerContext(LogicalDirection.Backward) != TextPointerContext.ElementStart;
211while (rangeEnd.GetPointerContext(LogicalDirection.Backward) == TextPointerContext.ElementStart)
213rangeEnd = rangeEnd.GetNextContextPosition(LogicalDirection.Backward);
219TextPointerContext runType = textReader.GetPointerContext(LogicalDirection.Forward);
224TextElement nextElement = (TextElement)textReader.GetAdjacentElement(LogicalDirection.Forward);
233textReader.MoveToNextContextPosition(LogicalDirection.Forward);
253textReader.MoveToNextContextPosition(LogicalDirection.Forward);
261textReader.MoveToNextContextPosition(LogicalDirection.Forward);
271if (ignoreWriteHyperlinkEnd && (textReader.GetAdjacentElement(LogicalDirection.Forward) is Hyperlink))
275textReader.MoveToNextContextPosition(LogicalDirection.Forward);
288textReader.MoveToNextContextPosition(LogicalDirection.Forward);
305textReader.MoveToNextContextPosition(LogicalDirection.Forward);
309int textLength = textReader.GetTextRunLength(LogicalDirection.Forward);
312textLength = TextPointerBase.GetTextWithLimit(textReader, LogicalDirection.Forward, text, 0, textLength, rangeEnd);
319textReader.MoveToNextContextPosition(LogicalDirection.Forward);
323object embeddedObject = textReader.GetAdjacentElement(LogicalDirection.Forward);
324textReader.MoveToNextContextPosition(LogicalDirection.Forward);
331textReader.MoveToNextContextPosition(LogicalDirection.Forward);
552InlineUIContainer inlineUIContainer = textReader.GetAdjacentElement(LogicalDirection.Backward) as InlineUIContainer;
553BlockUIContainer blockUIContainer = textReader.GetAdjacentElement(LogicalDirection.Backward) as BlockUIContainer;
1232TextElement uiContainer = fragment.ContentStart.GetAdjacentElement(LogicalDirection.Forward) as TextElement;
1338fragmentEnd = fragment.ElementEnd.GetPositionAtOffset(0, LogicalDirection.Forward); // need forward orientation to stick with the following content during merge at fragmentStart position
1366fragmentEnd = fragmentEnd.GetInsertionPosition(LogicalDirection.Forward);
1420while (positionBeforeParagraph.GetPointerContext(LogicalDirection.Backward) == TextPointerContext.ElementStart &&
1423positionBeforeParagraph = positionBeforeParagraph.GetNextContextPosition(LogicalDirection.Backward);
1425while (positionBeforeParagraph.GetPointerContext(LogicalDirection.Backward) == TextPointerContext.ElementStart &&
1429positionBeforeParagraph = positionBeforeParagraph.GetNextContextPosition(LogicalDirection.Backward);
1463if (navigator.GetPointerContext(LogicalDirection.Backward) == TextPointerContext.ElementEnd)
1465navigator = navigator.GetNextContextPosition(LogicalDirection.Backward);
1481if (navigator.GetPointerContext(LogicalDirection.Forward) == TextPointerContext.ElementStart)
1483navigator = navigator.GetNextContextPosition(LogicalDirection.Forward);
1518TextPointerContext forwardFromStart = start.GetPointerContext(LogicalDirection.Forward);
1519TextPointerContext backwardFromEnd = end.GetPointerContext(LogicalDirection.Backward);
1522Invariant.Assert(itemType.IsAssignableFrom(start.GetAdjacentElement(LogicalDirection.Forward).GetType()),
1524Invariant.Assert(itemType.IsAssignableFrom(end.GetAdjacentElement(LogicalDirection.Backward).GetType()),
1528TextPointerContext backwardFromStart = start.GetPointerContext(LogicalDirection.Backward);
1529TextPointerContext forwardFromEnd = end.GetPointerContext(LogicalDirection.Forward);
1531Invariant.Assert(!(backwardFromStart == TextPointerContext.ElementEnd) || itemType.IsAssignableFrom(start.GetAdjacentElement(LogicalDirection.Backward).GetType()),
1534Invariant.Assert(!(forwardFromEnd == TextPointerContext.ElementStart) || itemType.IsAssignableFrom(end.GetAdjacentElement(LogicalDirection.Forward).GetType()),
1556((Section)fragment).HasTrailingParagraphBreakOnPaste = range.End.GetPointerContext(LogicalDirection.Forward) != TextPointerContext.None;
1612start = start.GetNextContextPosition(LogicalDirection.Forward);
1616TextPointerContext passedContext = start.GetPointerContext(LogicalDirection.Backward);
1656start = start.GetNextContextPosition(LogicalDirection.Forward);
1663start = start.GetNextContextPosition(LogicalDirection.Forward);
1853Invariant.Assert(textReader.GetPointerContext(LogicalDirection.Forward) == TextPointerContext.ElementStart);
1858elementEnd.MoveToNextContextPosition(LogicalDirection.Forward);
1880Invariant.Assert(textReader.GetPointerContext(LogicalDirection.Forward) == TextPointerContext.ElementStart);
1881Invariant.Assert(typeof(Hyperlink).IsAssignableFrom(textReader.GetElementType(LogicalDirection.Forward)));
1886Hyperlink hyperlink = (Hyperlink)textReader.GetAdjacentElement(LogicalDirection.Forward);
1891hyperlinkEnd.MoveToNextContextPosition(LogicalDirection.Forward);
1906InlineUIContainer inlineUIContainer = hyperlinkNavigation.GetAdjacentElement(LogicalDirection.Forward) as InlineUIContainer;
1913hyperlinkNavigation.MoveToNextContextPosition(LogicalDirection.Forward);
1928hyperlinkStart = range.Start.CreatePointer(LogicalDirection.Forward);
1929while (hyperlinkStart.GetPointerContext(LogicalDirection.Backward) == TextPointerContext.ElementStart &&
System\windows\Documents\TextSelection.cs (64)
303((ITextSelection)this).SetCaretToPosition(((ITextRange)this).End, LogicalDirection.Forward, /*allowStopAtLineEnd:*/false, /*allowStopNearSpace:*/false);
454void ITextSelection.SetCaretToPosition(ITextPointer caretPosition, LogicalDirection direction, bool allowStopAtLineEnd, bool allowStopNearSpace)
469ITextPointer reversePosition = caretPosition.CreatePointer(direction == LogicalDirection.Forward ? LogicalDirection.Backward : LogicalDirection.Forward);
475TextPointerBase.IsNextToPlainLineBreak(caretPosition, LogicalDirection.Backward) ||
476TextSchema.IsBreak(caretPosition.GetElementType(LogicalDirection.Backward))))
480caretPosition.SetLogicalDirection(LogicalDirection.Forward);
484if (caretPosition.GetPointerContext(LogicalDirection.Backward) == TextPointerContext.Text &&
485caretPosition.GetPointerContext(LogicalDirection.Forward) == TextPointerContext.Text)
507LogicalDirection oppositeDirection = direction == LogicalDirection.Forward ? LogicalDirection.Backward : LogicalDirection.Forward;
584bool ITextSelection.ExtendToNextInsertionPosition(LogicalDirection direction)
619if (newMovingPosition == null && direction == LogicalDirection.Forward)
639LogicalDirection contentDirection = (anchorPosition.CompareTo(newMovingPosition) <= 0) ?
640LogicalDirection.Backward : LogicalDirection.Forward;
656private ITextPointer GetNextTextSegmentInsertionPosition(LogicalDirection direction)
843startPosition = anchorWordRange.Start.GetFrozenPointer(LogicalDirection.Forward);
844movingPosition = cursorWordRange.End.GetFrozenPointer(LogicalDirection.Backward);
848startPosition = anchorWordRange.End.GetFrozenPointer(LogicalDirection.Backward);
849movingPosition = cursorWordRange.Start.GetFrozenPointer(LogicalDirection.Forward);
965anchorWordRange.Contains(cursorPosition.GetInsertionPosition(LogicalDirection.Forward)) ||
966anchorWordRange.Contains(cursorPosition.GetInsertionPosition(LogicalDirection.Backward)))
978TextPointerBase.IsAtWordBoundary(anchorPosition, /*insideWordDirection:*/LogicalDirection.Forward))
992TextPointerBase.IsAtWordBoundary(cursorPosition, /*insideWordDirection:*/LogicalDirection.Forward))
1027bool ITextSelection.ExtendToNextTableRow(LogicalDirection direction)
1055if (direction == LogicalDirection.Forward)
1084movingPosition.MoveToNextInsertionPosition(LogicalDirection.Forward);
1184internal void SetCaretToPosition(TextPointer caretPosition, LogicalDirection direction, bool allowStopAtLineEnd, bool allowStopNearSpace)
1192internal bool ExtendToNextInsertionPosition(LogicalDirection direction)
1389this.SetCaretToPosition(cellStart, LogicalDirection.Backward, /*allowStopAtLineEnd:*/false, /*allowStopNearSpace:*/false);
1553Invariant.Assert(this.Start.LogicalDirection == LogicalDirection.Backward);
1554Invariant.Assert(this.End.LogicalDirection == LogicalDirection.Forward);
1759return (This.Start.GetPointerContext(LogicalDirection.Backward) != TextPointerContext.Text &&
1760This.End.GetPointerContext(LogicalDirection.Forward) != TextPointerContext.Text &&
1761This.Start.GetNextInsertionPosition(LogicalDirection.Backward) == null &&
1762This.End.GetNextInsertionPosition(LogicalDirection.Forward) == null);
1997(cursorPosition.LogicalDirection == LogicalDirection.Forward && objectEdgeRect.X < cursorMousePoint.X ||
1998cursorPosition.LogicalDirection == LogicalDirection.Backward && cursorMousePoint.X < objectEdgeRect.X))
2003(cursorPosition.LogicalDirection == LogicalDirection.Forward && objectEdgeRect.X > cursorMousePoint.X ||
2004cursorPosition.LogicalDirection == LogicalDirection.Backward && cursorMousePoint.X > objectEdgeRect.X))
2012(cursorPosition.LogicalDirection == LogicalDirection.Forward && objectEdgeRect.X > cursorMousePoint.X ||
2013cursorPosition.LogicalDirection == LogicalDirection.Backward && cursorMousePoint.X > objectEdgeRect.X))
2018(cursorPosition.LogicalDirection == LogicalDirection.Forward && objectEdgeRect.X < cursorMousePoint.X ||
2019cursorPosition.LogicalDirection == LogicalDirection.Backward && cursorMousePoint.X < objectEdgeRect.X))
2181if ((caretPosition.LogicalDirection == LogicalDirection.Backward && //
2182caretPosition.GetPointerContext(LogicalDirection.Backward) == TextPointerContext.ElementStart) || //
2189caretPosition.MoveToNextInsertionPosition(LogicalDirection.Backward);
2190caretPosition.SetLogicalDirection(LogicalDirection.Forward);
2198if (caretPosition.LogicalDirection == LogicalDirection.Backward && //
2199caretPosition.GetPointerContext(LogicalDirection.Backward) == TextPointerContext.ElementStart && //
2200(caretPosition.GetNextInsertionPosition(LogicalDirection.Backward) == null || //
2201TextPointerBase.IsNextToAnyBreak(caretPosition, LogicalDirection.Backward)))
2204caretPosition.SetLogicalDirection(LogicalDirection.Forward);
2278nextCharacterPosition = focusedTextSelection.Start.CreatePointer(LogicalDirection.Forward);
2283nextCharacterPosition.MoveToNextInsertionPosition(LogicalDirection.Forward);
2284nextCharacterPosition.SetLogicalDirection(LogicalDirection.Backward);
2292nextCharacterPosition = focusedTextSelection.End.CreatePointer(LogicalDirection.Backward);
2297nextCharacterPosition.MoveToNextInsertionPosition(LogicalDirection.Backward);
2298nextCharacterPosition.SetLogicalDirection(LogicalDirection.Forward);
2758private LogicalDirection _movingPositionDirection;
System\Windows\Documents\TextStore.cs (73)
378this.TextSelection.SetCaretToPosition(start, LogicalDirection.Backward, /*allowStopAtLineEnd:*/true, /*allowStopNearSpace:*/true);
418navigator = CreatePointerAtCharOffset(startIndex, LogicalDirection.Forward);
419limit = (endIndex >= 0) ? CreatePointerAtCharOffset(endIndex, LogicalDirection.Forward) : null;
426TextPointerContext context = navigator.GetPointerContext(LogicalDirection.Forward);
440TextElement element = (TextElement)((TextPointer)navigator).GetAdjacentElement(LogicalDirection.Forward);
449navigator.MoveToNextContextPosition(LogicalDirection.Forward);
455navigator.MoveToNextContextPosition(LogicalDirection.Forward);
502start = start.GetNextInsertionPosition(LogicalDirection.Forward);
696startNavigator.SetLogicalDirection(LogicalDirection.Backward);
698endNavigator.SetLogicalDirection(LogicalDirection.Forward);
876position = CreatePointerAtCharOffset(index, LogicalDirection.Forward);
992ITextPointer positionCur = position.CreatePointer(LogicalDirection.Backward);
993ITextPointer positionPrev = position.CreatePointer(LogicalDirection.Forward);
994positionPrev.MoveToNextInsertionPosition(LogicalDirection.Backward);
1061startPointer = CreatePointerAtCharOffset(startIndex, LogicalDirection.Forward);
1062startPointer.MoveToInsertionPosition(LogicalDirection.Forward);
1072Rect rectStart = startPointer.GetCharacterRect(LogicalDirection.Forward);
1080endPointer = CreatePointerAtCharOffset(endIndex, LogicalDirection.Backward);
1081endPointer.MoveToInsertionPosition(LogicalDirection.Backward);
1102lineRect = navigator.GetCharacterRect(LogicalDirection.Forward);
1103moved = navigator.MoveToNextInsertionPosition(LogicalDirection.Forward);
1497navigator.MoveToInsertionPosition(LogicalDirection.Forward);
1502if (navigator.GetPointerContext(LogicalDirection.Forward) == TextPointerContext.Text)
1508navigator.GetTextInRun(LogicalDirection.Forward, nextChars, 0, nextChars.Length);
1514TextSelection.ExtendToNextInsertionPosition(LogicalDirection.Forward);
1913internal ITextPointer CreatePointerAtCharOffset(int charOffset, LogicalDirection direction)
2022this.TextSelection.SetCaretToPosition(range.End, LogicalDirection.Backward, /*allowStopAtLineEnd:*/true, /*allowStopNearSpace:*/true);
2396_previousCompositionStart = (_previousCompositionStartOffset == -1) ? null : textEditor.TextContainer.CreatePointerAtOffset(_previousCompositionStartOffset, LogicalDirection.Backward);
2397_previousCompositionEnd = (_previousCompositionEndOffset == -1) ? null : textEditor.TextContainer.CreatePointerAtOffset(_previousCompositionEndOffset, LogicalDirection.Forward);
2415_previousCompositionStart = (_previousCompositionStartOffset == -1) ? null : textEditor.TextContainer.CreatePointerAtOffset(_previousCompositionStartOffset, LogicalDirection.Backward);
2416_previousCompositionEnd = (_previousCompositionEndOffset == -1) ? null : textEditor.TextContainer.CreatePointerAtOffset(_previousCompositionEndOffset, LogicalDirection.Forward);
2463Invariant.Assert(navigator.GetPointerContext(LogicalDirection.Forward) == TextPointerContext.Text);
2470runCount = TextPointerBase.GetTextWithLimit(navigator, LogicalDirection.Forward, text, charsCopied, Math.Min(cchReq, text.Length - charsCopied), limit);
2479runCount = navigator.GetTextRunLength(LogicalDirection.Forward);
2480navigator.MoveToNextContextPosition(LogicalDirection.Forward);
2522Invariant.Assert(navigator.GetPointerContext(LogicalDirection.Forward) == TextPointerContext.EmbeddedElement);
2532navigator.MoveToNextContextPosition(LogicalDirection.Forward);
2564Invariant.Assert(navigator.GetPointerContext(LogicalDirection.Forward) == TextPointerContext.ElementStart || navigator.GetPointerContext(LogicalDirection.Forward) == TextPointerContext.ElementEnd);
2582char ch = (navigator.GetAdjacentElement(LogicalDirection.Forward) is TableCell) ? UnsafeNativeMethods.TS_CHAR_REGION : '\n';
2913start = CreatePointerAtCharOffset(startIndex, LogicalDirection.Backward);
2914end = CreatePointerAtCharOffset(startIndex + length, LogicalDirection.Forward);
2916while (start.CompareTo(end) < 0 && start.GetPointerContext(LogicalDirection.Forward) != TextPointerContext.Text)
2918start.MoveToNextContextPosition(LogicalDirection.Forward);
3041positionNext.MoveToNextInsertionPosition(LogicalDirection.Forward);
3045positionNext.MoveToNextInsertionPosition(LogicalDirection.Backward);
3184Rect lineBounds = start.GetCharacterRect(LogicalDirection.Forward);
3185lineBounds.Union(end.GetCharacterRect(LogicalDirection.Backward));
3188ITextPointer navigator = start.CreatePointer(LogicalDirection.Forward);
3189while (navigator.MoveToNextContextPosition(LogicalDirection.Forward) == true && navigator.CompareTo(end) < 0)
3191TextPointerContext context = navigator.GetPointerContext(LogicalDirection.Backward);
3195lineBounds.Union(navigator.GetCharacterRect(LogicalDirection.Backward));
3200lineBounds.Union(navigator.GetCharacterRect(LogicalDirection.Backward));
3418TextPointer previousPosition = start.GetNextInsertionPosition(LogicalDirection.Backward);
3431if (start.GetPointerContext(LogicalDirection.Backward) == TextPointerContext.ElementStart)
3433start = start.GetNextInsertionPosition(LogicalDirection.Backward);
3437start = start.GetNextInsertionPosition(LogicalDirection.Forward);
3445start = start.GetNextInsertionPosition(LogicalDirection.Forward);
3465start = CreatePointerAtCharOffset(startCharOffset, LogicalDirection.Forward);
3466end = (startCharOffset == endCharOffset) ? start : CreatePointerAtCharOffset(endCharOffset, LogicalDirection.Backward);
3471TextPointerContext forwardContext = start.GetPointerContext(LogicalDirection.Forward);
3475TextElement element = start.GetAdjacentElement(LogicalDirection.Forward) as TextElement;
3487start.MoveToNextContextPosition(LogicalDirection.Forward);
3498start = start.GetFormatNormalizedPosition(LogicalDirection.Backward);
3503start = start.GetFormatNormalizedPosition(LogicalDirection.Backward);
3504end = end.GetFormatNormalizedPosition(LogicalDirection.Backward);
3646ITextPointer start = this.TextContainer.CreatePointerAtOffset(record.StartOffsetBefore, LogicalDirection.Backward);
3647ITextPointer end = this.TextContainer.CreatePointerAtOffset(record.EndOffsetBefore, LogicalDirection.Forward);
3808start = end.GetFrozenPointer(LogicalDirection.Backward);
3965ITextPointer anchor = this.TextContainer.CreatePointerAtOffset(appSelectionAnchorOffset, LogicalDirection.Forward);
3966ITextPointer moving = this.TextContainer.CreatePointerAtOffset(appSelectionMovingOffset, LogicalDirection.Forward);
3986ITextPointer anchor = this.TextContainer.CreatePointerAtOffset(imeSelectionAnchorOffset, LogicalDirection.Backward);
3987ITextPointer moving = this.TextContainer.CreatePointerAtOffset(imeSelectionMovingOffset, LogicalDirection.Backward);