setPositionsInRange(gapEnd, 0, gapStart);
resetMarksAtZero();
  protected void replace(int position, int rmSize, Object addItems,                         int addSize)  {    if (gapStart != position)      shiftGap(position);          // Remove content    if (rmSize > 0)    shiftGapEndUp(gapEnd + rmSize);    // If gap is too small, enlarge the gap.    if ((gapEnd - gapStart) <= addSize)      shiftEnd((addSize - gapEnd + gapStart + 1) * 2 + gapEnd + DEFAULT_BUFSIZE);    // Add new items to the buffer.    if (addItems != null)      {        System.arraycopy(addItems, 0, buffer, gapStart, addSize);                // Position objects having their mark at the end of the gap        // (results in an offset equal to gapStart) should be moved down        // because the size of the gap will decrease by addSize and the        // offsets will increase by the same amount and the latter should        // not happen.        setPositionsInRange(gapEnd, 0, gapStart);                gapStart += addSize;      }  }