public static int calculateOffset(@NotNull Editor editor, @NotNull Point point) {
    return editor.logicalPositionToOffset(editor.xyToLogicalPosition(point));
  }
public static int calculateOffset(@NotNull Editor editor, @NotNull Point point)