Esempio n. 1
0
        void AddMissingLines()
        {
            if (markedSpans.IsEmpty)
            {
                return;
            }
            var infos = new List <MarkedLineInfo>();

            foreach (var markedSpan in markedSpans.VisibleSpans)
            {
                foreach (var info in GetMarkedLineInfos(infos, markedSpan))
                {
                    if (toMarkedLine.ContainsKey(info.Line.IdentityTag))
                    {
                        continue;
                    }
                    var geo = MarkerHelper.CreateGeometry(textView, info.Span, markedSpans.IsBoxMode, info.IsMultiLineSpan, true);
                    if (geo == null)
                    {
                        continue;
                    }
                    var  markedLine = new MarkedLine(info.Span, geo, info.Line.IdentityTag, BackgroundBrush, Pen);
                    bool added      = adornmentLayer.AddAdornment(AdornmentPositioningBehavior.TextRelative, markedLine.Span.SnapshotSpan, markedLine, markedLine, adornmentRemovedCallback);
                    if (added)
                    {
                        toMarkedLine.Add(markedLine.IdentityTag, markedLine);
                    }
                }
            }
        }
Esempio n. 2
0
        KeyValuePair <SnapshotSpan, Geometry>?CreateStreamSelection()
        {
            Debug.Assert(!textSelection.IsEmpty && textSelection.Mode == TextSelectionMode.Stream);
            bool isMultiLine = MarkerHelper.IsMultiLineSpan(textSelection.TextView, textSelection.StreamSelectionSpan.SnapshotSpan);
            var  span        = textSelection.StreamSelectionSpan.Overlap(new VirtualSnapshotSpan(textSelection.TextView.TextViewLines.FormattedSpan));

            if (span == null)
            {
                return(null);
            }
            var geo = MarkerHelper.CreateGeometry(textSelection.TextView, span.Value, false, isMultiLine);

            if (geo == null)
            {
                return(null);
            }
            return(new KeyValuePair <SnapshotSpan, Geometry>(span.Value.SnapshotSpan, geo));
        }