public static int getVisualLineEndOffset(@NotNull Editor editor, int line) {
    return ReadAction.compute(() -> {
      VisualPosition endLineVisualPosition = new VisualPosition(line, getLastVisualLineColumnNumber(editor, line));
      return editor.visualPositionToOffset(endLineVisualPosition);
    });
  }
public static int getVisualLineEndOffset(@NotNull Editor editor, int line)