adjustPositionsInRange(gapEnd, newGapEnd - gapEnd, -(gapEnd - gapStart)); System.arraycopy(buffer, gapEnd, buffer, gapStart, newGapStart - gapStart); gapStart = newGapStart; gapEnd = newGapEnd;
int adjIndex = searchFirst(newGapStart); int count = marks.size(); for (int i = adjIndex; i < count; i++) { Mark m = (Mark) marks.get(i); if (m.mark >= oldEnd) break; m.mark += size; }
  protected void shiftGap(int newGapStart)  {    if (newGapStart == gapStart)      return;    int newGapEnd = newGapStart + gapEnd - gapStart;    if (newGapStart < gapStart)      {        // Update the positions between newGapStart and (old) gapStart. The marks        // must be shifted by (gapEnd - gapStart).        adjustPositionsInRange(newGapStart, gapStart - newGapStart, gapEnd - gapStart);        System.arraycopy(buffer, newGapStart, buffer, newGapEnd, gapStart                         - newGapStart);        gapStart = newGapStart;        gapEnd = newGapEnd;      }    else      {        // Update the positions between newGapEnd and (old) gapEnd. The marks        // must be shifted by (gapEnd - gapStart).        adjustPositionsInRange(gapEnd, newGapEnd - gapEnd, -(gapEnd - gapStart));        System.arraycopy(buffer, gapEnd, buffer, gapStart, newGapStart                         - gapStart);        gapStart = newGapStart;        gapEnd = newGapEnd;      }    if (gapStart == 0)      resetMarksAtZero();  }