private int getEndOffset() {
      if (toEnd) return myFile.getTextLength();
      TextRange range = getElementRange(endPointer);
      return range != null ? range.getEndOffset() : -1;
    }
private int getEndOffset()