private static @Nullable Couple<Integer> getTargetLineRange(@NotNull Caret caret) {
    Document document = caret.getEditor().getDocument();
    int startOffset = caret.hasSelection() ? caret.getSelectionStart() : 0;
    int endOffset = caret.hasSelection() ? caret.getSelectionEnd() : document.getTextLength();
    int startLine = document.getLineNumber(startOffset);
    int endLine = document.getLineNumber(endOffset);
    if (endOffset == document.getLineStartOffset(endLine)) {
      endLine--;
    }
    return startLine < endLine ? Couple.of(startLine, endLine) : null;
  }
private static @Nullable Couple<Integer> getTargetLineRange(@NotNull Caret caret)