GetCurrentLine() public method

Gets the text of the line containing the caret.
public GetCurrentLine ( ) : string
return string
Exemplo n.º 1
0
        private static string GetWordNearCursor(Scintilla editor)
        {
            int caretPos;
            var s = " " + editor.GetCurrentLine(out caretPos) + " ";
            caretPos = Math.Min(caretPos, s.Length - 1);

            do
            {
                if (caretPos == 0)
                    break;
            } while (!IsWordEndChar(s[--caretPos]));

            for (var i = (++caretPos) + 1; i < s.Length; i++)
                if (IsWordEndChar(s[i]))
                    return s.Substring(caretPos, i - caretPos);

            return String.Empty;
        }