Microsoft.R.Editor.Document.REditorDocument.MapPointFromView C# (CSharp) Method

MapPointFromView() public static method

Maps given point from view buffer to R editor buffer
public static MapPointFromView ( ITextView textView, SnapshotPoint point ) : SnapshotPoint?
textView ITextView
point SnapshotPoint
return SnapshotPoint?
        public static SnapshotPoint? MapPointFromView(ITextView textView, SnapshotPoint point) {
            ITextBuffer rBuffer;
            SnapshotPoint? documentPoint = null;

            IREditorDocument document = REditorDocument.FindInProjectedBuffers(textView.TextBuffer);
            if (document != null) {
                rBuffer = document.TextBuffer;
            } else {
                // Last resort, typically in unit tests when document is not available
                rBuffer = REditorDocument.FindRBuffer(textView.TextBuffer);
            }

            if (rBuffer != null) {
                if (textView.BufferGraph != null) {
                    documentPoint = textView.MapDownToBuffer(point, rBuffer);
                } else {
                    documentPoint = point;
                }
            }

            return documentPoint;
        }