示例#1
0
        public Collection <TF.TextBounds> GetNormalizedTextBounds(SnapshotSpan bufferSpan)
        {
            if (!IsValid)
            {
                throw new ObjectDisposedException(nameof(WpfTextViewLine));
            }
            if (bufferSpan.Snapshot != Snapshot)
            {
                throw new ArgumentException();
            }
            var span = ExtentIncludingLineBreak.Intersection(bufferSpan);
            var list = new List <TF.TextBounds>();

            if (span == null)
            {
                return(new Collection <TF.TextBounds>(list));
            }

            //TODO: Handle RTL text and adornments

            var startBounds = GetFirstTextBounds(span.Value.Start);
            var endBounds   = GetLastTextBounds(span.Value.End);

            if (span.Value.End > End)
            {
                endBounds = new TF.TextBounds(
                    endBounds.Trailing + EndOfLineWidth,
                    endBounds.Top,
                    0,
                    endBounds.Height,
                    endBounds.TextTop,
                    endBounds.TextHeight);
            }

            list.Add(new TF.TextBounds(startBounds.Left, startBounds.Top, endBounds.Left - startBounds.Left, startBounds.Height, startBounds.TextTop, startBounds.TextHeight));

            return(new Collection <TF.TextBounds>(list));
        }
示例#2
0
 /// <summary>
 /// Provides a hash function for <see cref="SourceTextLine"/>.
 /// </summary>
 public override int GetHashCode()
 {
     return(Line ^ ExtentIncludingLineBreak.GetHashCode());
 }
示例#3
0
 public override string ToString()
 {
     return(ExtentIncludingLineBreak.ToString());
 }
示例#4
0
 public bool ContainsBufferPosition(SnapshotPoint bufferPosition) => ExtentIncludingLineBreak.Contains(bufferPosition);
示例#5
0
 public string GetTextIncludingLineBreak()
 {
     return(ExtentIncludingLineBreak.GetText());
 }