offset = newBranch.getEndOffset();
pos = newBranch.getEndOffset();
    private void recreateLeaves(int start, BranchElement paragraph, boolean onlyContent)    {      int index = paragraph.getElementIndex(start);      Element child = paragraph.getElement(index);      AttributeSet atts = child.getAttributes();            if (!onlyContent)        {          BranchElement newBranch = (BranchElement) createBranchElement(paragraph,                                                                        atts);          Element newLeaf = createLeafElement(newBranch, atts, start,                                               child.getEndOffset());          newBranch.replace(0, 0, new Element[] { newLeaf });                    BranchElement parent = (BranchElement) paragraph.getParentElement();          int parSize = parent.getElementCount();          Edit edit = getEditForParagraphAndIndex(parent, parSize);          edit.addAddedElement(newBranch);                      int paragraphSize = paragraph.getElementCount();          Element[] removed = new Element[paragraphSize - (index + 1)];          int s = 0;          for (int j = index + 1; j < paragraphSize; j++)            removed[s++] = paragraph.getElement(j);                    edit = getEditForParagraphAndIndex(paragraph, index);          edit.addRemovedElements(removed);          Element[] added = recreateAfterFracture(removed, newBranch, 0, child.getEndOffset());          newBranch.replace(1, 0, added);                    lastFractured = newLeaf;          offset = newBranch.getEndOffset();        }      else        {          Element newLeaf = createLeafElement(paragraph, atts, start,                                               child.getEndOffset());              Edit edit = getEditForParagraphAndIndex(paragraph, index);          edit.addAddedElement(newLeaf);        }        }