int index = -1; for (int i = 0; i < children.length; i++) { if (children[i].getStartOffset() <= pos && children[i].getEndOffset() > pos) { index = i; break; } } return index;
Element el = getElement(); return el.getElementIndex(pos);
  protected int getViewIndexAtPosition(int pos)  {    int index = -1;    for (int i = 0; i < children.length; i++)      {        if (children[i].getStartOffset() <= pos            && children[i].getEndOffset() > pos)          {            index = i;            break;          }      }    return index;  }