int yToVisualLine(int y) {
    int lineHeight = myView.getLineHeight();
    y = Math.max(0, y - myView.getInsets().top);
    if (y < lineHeight) return 0;
    int lineMin = 0;
    int yMin = 0;
    int lineMax = myView.getEditor().getVisibleLineCount() - 1;
    int yMax = visualLineToY(lineMax + 1);
    if (y >= yMax) {
      return lineMax + 1 + (y - yMax) / lineHeight;
    }
    while (lineMin < lineMax) {
      if ((yMax - yMin) == (lineMax - lineMin + 1) * lineHeight) return lineMin + (y - yMin) / lineHeight;
      int lineMid = (lineMin + lineMax) / 2;
      int[] yMidRange = visualLineToYRange(lineMid);
      if (y < yMidRange[0]) {
        int yMidMin = yMidRange[0] - getInlaysHeight(lineMid, true);
        if (y >= yMidMin) return lineMid;
        lineMax = lineMid - 1;
        yMax = yMidMin;
      }
      else {
        int yMidMax = yMidRange[1] + getInlaysHeight(lineMid, false);
        if (y < yMidMax) return lineMid;
        lineMin = lineMid + 1;
        yMin = yMidMax;
      }
    }
    return lineMin;
  }
int yToVisualLine(int y)