public int FindStartOfNextWord(int p)
{
int length = this.text.Length;
if (p != length)
{
char c = this.text[p];
CharacterType type = this.ClassifyChar(c);
if (type != CharacterType.WhiteSpace)
{
p++;
while ((p < length) && (this.ClassifyChar(this.text[p]) == type))
{
p++;
}
}
else
{
switch (c)
{
case '\t':
case '\n':
return (p + 1);
}
}
if (p == length)
{
return p;
}
switch (this.text[p])
{
case ' ':
while ((p < length) && char.IsWhiteSpace(this.text[p]))
{
p++;
}
return p;
case '\t':
case '\n':
return p;
}
}
return p;
}