コード例 #1
0
        /// <inheritdoc />
        public TextCaret GetNextPosition()
        {
            var maybeNextOffset = Buffer.GetNextOffset(Offset);

            if (maybeNextOffset != null)
            {
                var nextOffset = maybeNextOffset.GetValueOrDefault();
                return(new TextCaret(Content, nextOffset));
            }

            // point to just after the last character (unless we're empty in which case we're already doing that)
            if (Buffer.GetLastOffset().GraphemeOffset == Offset.GraphemeOffset &&
                Buffer.GraphemeLength != 0)
            {
                return(new TextCaret(Content, TextOffsetHelpers.CreateAfterTextOffset(Buffer)));
            }

            return(Invalid);
        }
コード例 #2
0
 /// <summary> Gets a cursor that is looking at the end of the content. </summary>
 public static TextCaret FromEnd(TextBlockContent content)
 {
     return(new TextCaret(content,
                          TextOffsetHelpers.CreateAfterTextOffset(content.Buffer)));
 }