Edit edit = getEditForParagraphAndIndex(par, index); edit.addRemovedElements(removed); edit.addAddedElements(added);
e.addAddedElements(added); e.addRemovedElements(removed);
    private Element insertParagraph(BranchElement par, int offset)    {      Element current = par.getElement(par.getElementIndex(offset));      Element[] res = split(current, offset, 0);      int index = par.getElementIndex(offset);      Element ret;      if (res[1] != null)        {          Element[] removed;          Element[] added;          if (res[0] == null)            {              removed = new Element[0];              if (res[1] instanceof BranchElement)                {                  added = new Element[]{ res[1] };                  ret = res[1];                }              else                {                  ret = createBranchElement(par, null);                  added = new Element[]{ ret, res[1] };                }              index++;            }          else            {              removed = new Element[]{ current };              if (res[1] instanceof BranchElement)                {                  ret = res[1];                  added = new Element[]{ res[0], res[1] };                }              else                {                  ret = createBranchElement(par, null);                  added = new Element[]{ res[0], ret, res[1] };                }            }          Edit edit = getEditForParagraphAndIndex(par, index);          edit.addRemovedElements(removed);          edit.addAddedElements(added);        }      else        {          ret = createBranchElement(par, null);          Edit edit = getEditForParagraphAndIndex(par, index);          edit.addAddedElement(ret);        }      return ret;    }