FindInProjectedBuffers() public static method

Given text view locates R document in underlying text buffer graph. In REPL window there may be multiple R text buffers but usually only last one (the one active at the > prompt) has attached R document. Other R buffers represent previously typed commands. They still have colorizer attached but no active R documents.
public static FindInProjectedBuffers ( ITextBuffer viewBuffer ) : IREditorDocument
viewBuffer ITextBuffer
return IREditorDocument
Beispiel #1
0
        /// <summary>
        /// Maps given point from view buffer to R editor buffer
        /// </summary>
        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);
        }