private @Nullable XmlText _splitText(final int displayOffset) throws IncorrectOperationException{
    final XmlTag xmlTag = (XmlTag)getParent();
    if(displayOffset == 0) return this;
    final int length = getValue().length();
    if(displayOffset >= length) {
      return null;
    }

    XmlTextImpl result;

    final int physicalOffset = displayToPhysical(displayOffset);
    PsiElement childElement = findElementAt(physicalOffset);

    if (childElement != null && childElement.getNode().getElementType() == XmlTokenType.XML_DATA_CHARACTERS) {
      FileElement holder = DummyHolderFactory.createHolder(getManager(), null).getTreeElement();

      int splitOffset = physicalOffset - childElement.getStartOffsetInParent();
      result = (XmlTextImpl)ASTFactory.composite(XmlElementType.XML_TEXT);
      CodeEditUtil.setNodeGenerated(result, true);
      holder.rawAddChildren(result);

      PsiElement e = childElement;
      while (e != null) {
        CodeEditUtil.setNodeGenerated(e.getNode(), true);
        e = e.getNextSibling();
      }

      String leftText = childElement.getText().substring(0, splitOffset);
      String rightText = childElement.getText().substring(splitOffset);


      LeafElement rightElement =
        ASTFactory.leaf(XmlTokenType.XML_DATA_CHARACTERS, holder.getCharTable().intern(rightText));
      CodeEditUtil.setNodeGenerated(rightElement, true);

      LeafElement leftElement = ASTFactory.leaf(XmlTokenType.XML_DATA_CHARACTERS, holder.getCharTable().intern(leftText));
      CodeEditUtil.setNodeGenerated(leftElement, true);

      rawInsertAfterMe(result);

      result.rawAddChildren(rightElement);
      if (childElement.getNextSibling() != null) {
        result.rawAddChildren((TreeElement)childElement.getNextSibling());
      }
      DebugUtil.performPsiModification("xmlText split",  () -> ((TreeElement)childElement).rawRemove());
      this.rawAddChildren(leftElement);
    }
    else {
      final PsiFile containingFile = xmlTag.getContainingFile();
      final FileElement holder = DummyHolderFactory
        .createHolder(containingFile.getManager(), null, ((PsiFileImpl)containingFile).getTreeElement().getCharTable()).getTreeElement();
      final XmlTextImpl rightText = (XmlTextImpl)ASTFactory.composite(XmlElementType.XML_TEXT);
      CodeEditUtil.setNodeGenerated(rightText, true);

      holder.rawAddChildren(rightText);

      ((ASTNode)xmlTag).addChild(rightText, getTreeNext());

      final String value = getValue();

      setValue(value.substring(0, displayOffset));
      rightText.setValue(value.substring(displayOffset));

      CodeEditUtil.setNodeGenerated(rightText, true);

      result = rightText;
    }

    clearCaches();
    result.clearCaches();
    return result;
  }
private @Nullable XmlText _splitText(final int displayOffset)