private void invalidate(@NotNull ClientState state) {
    state.myMerger.flushCurrentCommand(state.nextCommandTimestamp(), state.myUndoStacksHolder);
    Set<DocumentReference> affected = new HashSet<>();
    state.myRedoStacksHolder.collectAllAffectedDocuments(affected);
    state.myRedoStacksHolder.clearStacks(true, affected);
    state.myUndoStacksHolder.collectAllAffectedDocuments(affected);
    state.myUndoStacksHolder.clearStacks(true, affected);
    mySharedRedoStacksHolder.trimStacks(affected);
    mySharedUndoStacksHolder.trimStacks(affected);
  }
private void invalidate(@NotNull ClientState state)