private int convertPointToLineNumber(Point p) {
    DocumentEx document = myEditor.getDocument();
    int line = EditorUtil.yPositionToLogicalLine(myEditor, p);
    if (!DocumentUtil.isValidLine(line, document)) return -1;

    int startOffset = document.getLineStartOffset(line);
    FoldRegion region = myEditor.getFoldingModel().getCollapsedRegionAtOffset(startOffset);
    if (region != null) {
      return document.getLineNumber(region.getEndOffset());
    }
    return line;
  }
private int convertPointToLineNumber(Point p)