src/Misc/EFTools/DesignXmlCore/Refactoring/PreviewBuffer.cs
/// <summary>
///     Get entire TextLines buffer as a TextSpan
/// </summary>
/// <param name="pBuffer"></param>
/// <returns></returns>
Get entire TextLines buffer as a TextSpan
Get entire TextLines buffer as a TextSpan
private static TextSpan GetBufferSpan(IVsTextLines textBuffer)
        {
            ArgumentValidation.CheckForNullReference(textBuffer, "textBuffer");
            var lineCount = 0;
            var charCount = 0;
            var result = textBuffer.GetLineCount(out lineCount);
            if (result == VSConstants.S_OK
                && lineCount > 0)
            {
                result = textBuffer.GetLengthOfLine(lineCount - 1, out charCount);
                if (result != VSConstants.S_OK)
                {
                    charCount = 0;
                }
            }
            else
            {
                lineCount = 0;
            }
            var span = new TextSpan();
            span.iStartLine = 0;
            span.iStartIndex = 0;
            span.iEndLine = lineCount - 1 > 0 ? lineCount - 1 : 0;
            span.iEndIndex = charCount > 0 ? charCount : 0;
            return span;
        }
private static TextSpan GetBufferSpan ( IVsTextLines textBuffer ) { ArgumentValidation . CheckForNullReference ( textBuffer , " " ) ; var lineCount = 0 ; var charCount = 0 ; var result = textBuffer . GetLineCount ( out lineCount ) ; if ( result == VSConstants . S_OK && lineCount > 0 ) { result = textBuffer . GetLengthOfLine ( lineCount - 1 , out charCount ) ; if ( result != VSConstants . S_OK ) { charCount = 0 ; } } else { lineCount = 0 ; } var span = new TextSpan ( ) ; span . iStartLine = 0 ; span . iStartIndex = 0 ; span . iEndLine = lineCount - 1 > 0 ? lineCount - 1 : 0 ; span . iEndIndex = charCount > 0 ? charCount : 0 ; return span ; }
Get entire TextLines buffer as a TextSpan
Get entire TextLines buffer as a TextSpan
// Get line count for the whole buffer. // Get char count for last line. // Create a TextSpan from begin to end of the text buffer.
None
textBuffer
IVsTextLines
pBuffer
None