/**
  * Helper function returns -1 if the line is empty else returns the
  * amount of whitespace pt is indented by
  */
 private static int SkipWhitespace(
     EnvDTE.EditPoint pt)
 {
     int start = pt.DisplayColumn;
     while (!pt.AtEndOfLine &&
         ((pt.GetText(1) == " ") ||
         (pt.GetText(1) == "\t")))
     {
         pt.CharRight(1);
     }
     if (pt.AtEndOfLine)
     {
         return -1;
     }
     else
     {
         return pt.DisplayColumn-start;
     }
 }
 private static void GoToEndOfPreviousWord(
     EnvDTE.EditPoint pt)
 {
     pt.CharLeft(1);
     while ((pt.GetText(1) != " ") &&
         (pt.GetText(1) != "\t"))
     {
         pt.CharLeft(1);
     }
     while ((pt.GetText(1) == " ") ||
         (pt.GetText(1) == "\t"))
     {
         pt.CharLeft(1);
     }
     pt.CharRight(1);
 }
 private static string GetTextOnLine(EnvDTE.EditPoint pt, int length)
 {
     if (length > (pt.LineLength - (pt.LineCharOffset-1)))
     {
         length = pt.LineLength - (pt.LineCharOffset-1);
     }
     string st = pt.GetText(length);
     return st;
 }
 // pre: must be a word before the end of the line moves to the end of
 // the word
 private static void GoToEndOfNextWord(
     EnvDTE.EditPoint pt)
 {
     while ((pt.GetText(1) == " ") ||
         (pt.GetText(1) == "\t"))
     {
         pt.CharRight(1);
     }
     while ((!pt.AtEndOfLine) &&
         (pt.GetText(1) != " ") &&
         (pt.GetText(1) != "\t"))
     {
         pt.CharRight(1);
     }
 }
 private static string GetRestOfLine(EnvDTE.EditPoint pt)
 {
     return pt.GetText(pt.LineLength - (pt.LineCharOffset-1));
 }