public static int calcAfterLineEnd(@NotNull Editor editor) {
    CaretModel caretModel = editor.getCaretModel();
    int caretOffset = caretModel.getOffset();
    LogicalPosition logicalPosition = caretModel.getLogicalPosition();
    VisualPosition visualPosition = caretModel.getVisualPosition();
    return calcAfterLineEnd(editor, caretOffset, logicalPosition, visualPosition);
  }
public static int calcAfterLineEnd(@NotNull Editor editor)