Mono.Terminal.LineEditor.WordForward C# (CSharp) Method

WordForward() private method

private WordForward ( int p ) : int
p int
return int
        int WordForward(int p)
        {
            if (p >= text.Length)
                return -1;

            int i = p;
            if (Char.IsPunctuation(text[p]) || Char.IsSymbol(text[p]) || Char.IsWhiteSpace(text[p]))
            {
                for (; i < text.Length; i++)
                {
                    if (Char.IsLetterOrDigit(text[i]))
                        break;
                }
                for (; i < text.Length; i++)
                {
                    if (!Char.IsLetterOrDigit(text[i]))
                        break;
                }
            }
            else
            {
                for (; i < text.Length; i++)
                {
                    if (!Char.IsLetterOrDigit(text[i]))
                        break;
                }
            }
            if (i != p)
                return i;
            return -1;
        }