예제 #1
0
        public static bool IsMultilineSelected(this IWpfTextView textView)
        {
            var s = textView.Selection;

            if (s.IsEmpty || s.SelectedSpans.Count < 1)
            {
                return(false);
            }
            var buffer = textView.TextViewLines;

            Microsoft.VisualStudio.Text.Formatting.IWpfTextViewLine line = null, line2;
            foreach (var item in s.SelectedSpans)
            {
                line2 = buffer.GetTextViewLineContainingBufferPosition(item.Start);
                if (line == null)
                {
                    line = line2;
                    continue;
                }
                if (line2 != line)
                {
                    return(true);
                }
                line2 = buffer.GetTextViewLineContainingBufferPosition(item.End);
                if (line2 != line)
                {
                    return(true);
                }
            }
            return(false);
        }
예제 #2
0
        private static void Execute(object sender, EventArgs e)
        {
            IWpfTextView view = GetTextView();

            if (view == null)
            {
                return;
            }

            Microsoft.VisualStudio.Text.SnapshotPoint position           = view.Selection.Start.Position;
            Microsoft.VisualStudio.Text.Formatting.IWpfTextViewLine line = view.GetTextViewLineContainingBufferPosition(position);
            Microsoft.VisualStudio.Text.SnapshotSpan span = line.Extent;

            view.Selection.Select(span, false);
        }
예제 #3
0
 /// <summary>
 /// Show spans for line only
 /// </summary>
 /// <param name="line"></param>
 internal void ShowForLine(Microsoft.VisualStudio.Text.Formatting.IWpfTextViewLine line)
 {
     _lineSpans = LineCoverageGlyphFactory.GetSpansForLine(line, _currentSpans);
     RaiseAllTagsChanged();
 }