@Override
  public @Nullable String preprocessOnCopy(PsiFile file, int[] startOffsets, int[] endOffsets, String text) {
    if (startOffsets.length != 1 || endOffsets.length != 1) {
      return null;
    }
    Document document = PsiDocumentManager.getInstance(file.getProject()).getDocument(file);
    if (document == null) {
      return null;
    }

    int caretOffset = startOffsets[0];
    PsiElement element = file.findElementAt(caretOffset);
    if (element == null) {
      return null;
    }
    PsiElement prevLeaf = PsiTreeUtil.prevLeaf(element, true);
    if (prevLeaf instanceof PsiWhiteSpace) {
      prevLeaf = PsiTreeUtil.prevLeaf(prevLeaf, true);
    }

    if (element instanceof PsiWhiteSpace) {
      element = PsiTreeUtil.nextLeaf(element, true);
      if (element == null) {
        return null;
      }
    }

    boolean inTheStartOfSubElement =
      isYamlElementType(element) && PsiUtilCore.getElementType(element) == YAMLTokenTypes.INDENT
      ||
      element.getTextRange().getStartOffset() == caretOffset &&
      isYamlElementType(prevLeaf) &&
      PsiUtilCore.getElementType(prevLeaf) == YAMLTokenTypes.INDENT
      ||
      element.getTextRange().getStartOffset() >= caretOffset &&
      isYamlElementType(prevLeaf) &&
      PsiUtilCore.getElementType(prevLeaf) == YAMLTokenTypes.SEQUENCE_MARKER;

    if (!inTheStartOfSubElement) {
      return null;
    }

    int lineStartOffset = DocumentUtil.getLineStartOffset(caretOffset, document);

    if (lineStartOffset == caretOffset) {
      return null;
    }

    PsiElement borderParent = PsiTreeUtil.findFirstParent(
      PsiTreeUtil.nextLeaf(element, false), true,
      (psi) -> psi instanceof YAMLBlockSequenceImpl || psi instanceof YAMLBlockMappingImpl
    );

    if (borderParent == null) {
      return null;
    }

    int endOffset = endOffsets[0];
    // one step back from the end of line and from end of file
    PsiElement endElement = file.findElementAt(endOffset - 1);
    if (endElement != null) {
      if (YAMLUtil.psiAreAtTheSameLine(element, endElement)) {
        return null;
      }
    }

    if (borderParent.getTextRange().getEndOffset() < endOffset) {
      PsiElement nextElement = borderParent;
      while (true) {
        nextElement = PsiTreeUtil.nextLeaf(nextElement, true);
        if (nextElement == null || nextElement.getTextRange().getStartOffset() >= endOffset) {
          break;
        }

        IElementType elementType = PsiUtilCore.getElementType(nextElement);
        if (!(elementType instanceof YAMLElementType)) {
          return null;
        }

        if (!YAMLElementTypes.BLANK_ELEMENTS.contains(elementType)) {
          return null;
        }
      }
    }

    return StringUtil.repeatSymbol(' ', caretOffset - lineStartOffset) + text;
  }
@Override
  public @Nullable String preprocessOnCopy(PsiFile file, int[] startOffsets, int[] endOffsets, String text)