code: public int findTokenStart(CharSequence text, int cursor) {
          /*
           * It's hard to search backward, so search forward until
           * we reach the cursor.
           */
  
          int best = 0;
          int i = 0;
  
          while (i < cursor) {
              i = findTokenEnd(text, i);
  
              if (i < cursor) {
                  i++; // Skip terminating punctuation
  
                  while (i < cursor && text.charAt(i) == ' ') {
                      i++;
                  }
  
                  if (i < cursor) {
                      best = i;
                  }
              }
          }
  
          return best;
      }
docs: {@inheritDoc}