Exemple #1
0
        protected override int?codeUnitAtVisitor(int index, Accumulator offset)
        {
            if (text == null)
            {
                return(null);
            }

            if (index - offset.value < text.Length)
            {
                return(text[index - offset.value]);
            }

            offset.increment(text.Length);
            return(null);
        }
Exemple #2
0
        protected override InlineSpan getSpanForPositionVisitor(TextPosition position, Accumulator offset)
        {
            if (text == null)
            {
                return(null);
            }

            TextAffinity affinity     = position.affinity;
            int          targetOffset = position.offset;
            int          endOffset    = offset.value + text.Length;

            if (offset.value == targetOffset && affinity == TextAffinity.downstream ||
                offset.value < targetOffset && targetOffset < endOffset ||
                endOffset == targetOffset && affinity == TextAffinity.upstream)
            {
                return(this);
            }

            offset.increment(text.Length);
            return(null);
        }