public static int getNextLineStopOffset(@NotNull Editor editor, @NotNull CaretStop lineStop) {
    final Document document = editor.getDocument();
    final CaretModel caretModel = editor.getCaretModel();

    final int lineNumber = caretModel.getLogicalPosition().line;
    final boolean isAtLineEnd = (caretModel.getOffset() == document.getLineEndOffset(lineNumber));

    return getNextLineStopOffset(document, lineStop, lineNumber, isAtLineEnd);
  }
public static int getNextLineStopOffset(@NotNull Editor editor, @NotNull CaretStop lineStop)