public static int yPositionToLogicalLine(@NotNull Editor editor, int y) {
    return ReadAction.compute(() -> {
      int line = editor instanceof EditorImpl ? editor.yToVisualLine(y) : y / editor.getLineHeight();
      return editor.visualToLogicalPosition(new VisualPosition(line, 0)).line;
    });
  }
public static int yPositionToLogicalLine(@NotNull Editor editor, int y)