Ejemplo n.º 1
0
 /// <summary>
 /// Construct a new edit span object
 /// </summary>
 /// <param name="toReplace">The text span to remove from the buffer (can be empty)</param>
 /// <param name="insertText">The text to insert in it's place (can be null)</param>
 internal EditSpan(TextSpan toReplace, string insertText)
 {
     if (!TextSpanHelper.IsPositive(toReplace))
     {
         TextSpanHelper.MakePositive(ref toReplace);
     }
     this.span      = toReplace;
     this.text      = insertText;
     this.lineCount = -1;
 }
Ejemplo n.º 2
0
        // This method simulates what VS does in debug mode so that we can catch the
        // errors in managed code before they go to the native debug assert.
        internal static bool ValidSpan(ISource src, TextSpan span)
        {
            if (!ValidCoord(src, span.iStartLine, span.iStartIndex))
            {
                return(false);
            }

            if (!ValidCoord(src, span.iEndLine, span.iEndIndex))
            {
                return(false);
            }

            // end must be >= start
            if (!TextSpanHelper.IsPositive(span))
            {
                return(false);
            }

            return(true);
        }