private static @Nullable Couple<Block> getBlockAtOffset(@Nullable Block parent, @NotNull Block block, int offset) {
    TextRange textRange = block.getTextRange();
    int startOffset = textRange.getStartOffset();
    int endOffset = textRange.getEndOffset();
    if (startOffset == offset) {
      return Couple.of(parent, block);
    }
    if (startOffset > offset || endOffset < offset || block.isLeaf()) {
      return null;
    }
    for (Block subBlock : block.getSubBlocks()) {
      Couple<Block> result = getBlockAtOffset(block, subBlock, offset);
      if (result != null) {
        return result;
      }
    }
    return null;
  }
private static @Nullable Couple<Block> getBlockAtOffset(@Nullable Block parent, @NotNull Block block, int offset)