Ejemplo n.º 1
0
        private static Range GetRange(ITextView textView, ITextBuffer textBuffer)
        {
            var bufferStart = textView.GetPointAtSubjectBuffer(textView.Selection.Start.Position, textBuffer);
            var bufferEnd   = textView.GetPointAtSubjectBuffer(textView.Selection.End.Position, textBuffer);

            if (bufferStart.HasValue && bufferEnd.HasValue)
            {
                return(new Range {
                    Start = bufferStart.Value.GetPosition(),
                    End = bufferEnd.Value.GetPosition()
                });
            }

            return(null);
        }
Ejemplo n.º 2
0
 internal static SnapshotPoint?GetCaretPointAtSubjectBuffer(this ITextView textView, ITextBuffer textBuffer)
 {
     return(textView.GetPointAtSubjectBuffer(textView.Caret.Position.BufferPosition, textBuffer));
 }