ARCed.Scintilla.Lexing.LineUncomment C# (CSharp) Method

LineUncomment() public method

public LineUncomment ( ) : void
return void
        public void LineUncomment()
        {
            if (string.IsNullOrEmpty(this._lineCommentPrefix))
                return;

            NativeScintilla.BeginUndoAction();

            // Uncommenting is a lot like line commenting. However in addition
            // to looking for a non-whitespace character, the string that follows
            // it MUST be our line Comment Prefix. If this is the case the prefex
            // is removed from the line at its position.
            Range selRange = Scintilla.Selection.Range;
            int start = selRange.StartingLine.Number;
            int end = selRange.EndingLine.Number;

            int offset = this._lineCommentPrefix.Length;

            for (int i = start; i <= end; i++)
            {
                Line l = Scintilla.Lines[i];
                int firstWordChar = this.FindFirstNonWhitespaceChar(l.Text);
                if (firstWordChar >= 0)
                {
                    int startPos = l.StartPosition + firstWordChar;
                    Range commentRange = Scintilla.GetRange(startPos, startPos + offset);
                    if (commentRange.Text == this._lineCommentPrefix)
                        commentRange.Text = string.Empty;
                }
            }

            NativeScintilla.EndUndoAction();
        }