void () { ClientId aId = registerClient("A.id", myProject, myDisposable); ClientId bId = registerClient("B.id", myProject, myDisposable); typeWithoutFlush('1'); typeWithoutFlush('2', aId); typeWithoutFlush('3', bId); typeWithoutFlush('4'); typeWithoutFlush('5', aId); typeWithoutFlush('6', bId); flushCommandMergers(ClientId.getLocalId(), aId, bId); checkEditorText("123456test", getFirstEditor()); // Undo in "correct" order undoFirstEditor(bId); undoFirstEditor(aId); while (isUndoInFirstEditorAvailable()) { // May require extra undo due to moved caret undoFirstEditor(); } checkEditorText("test", getFirstEditor()); // Now shared redo stack is [(old) 6, 3, 5, 2, 4, 1 (recent)] // Redo in "incorrect" order redoFirstEditor(bId); checkEditorText("36test", getFirstEditor()); redoFirstEditor(aId); checkEditorText("2356test", getFirstEditor()); }