*        The type of the patch, as a constant from OPT.
   */
  public void storeUndo(UndoPatch undo, int patchType) {
    undo.opTag = patchType;
    while (patchIndex < undoPatches.size()) {
      undoPatches.remove(undoPatches.size() - 1);
    }
    if (!undoCanMerge || patchIndex == 0
        || !undoCompatible(undoPatches.get(patchIndex - 1), undo)) {
      undoPatches.add(undo);
      undoCanMerge = true;
      patchIndex++;
    } else {
      undoMerge(undo, undoPatches.get(patchIndex - 1));
    }
  }