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

    final int lineNumber = caretModel.getLogicalPosition().line;
    final boolean isAtLineStart = (caretModel.getOffset() == document.getLineStartOffset(lineNumber));

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