void () { ClientId aId = registerClient("A.id", myProject, myDisposable); ClientId bId = registerClient("B.id", myProject, myDisposable); getFirstEditor().getSelectionModel().setSelection(0, 4); backspace(getFirstEditor()); checkEditorText("", getFirstEditor()); undoFirstEditor(); checkEditorText("test", getFirstEditor()); runWithCaretStatePreserved(getFirstEditor(), () -> { // Keep caret state so no extra redo is needed setCaretState(getFirstEditor(), 2, 2, 2); typeWithFlush('1', aId); checkEditorText("te1st", getFirstEditor()); }); try { redoFirstEditor(); fail("Exception expected"); } catch (Exception ignored) { } checkEditorText("te1st", getFirstEditor()); runWithCaretStatePreserved(getFirstEditor(), () -> { setCaretState(getFirstEditor(), 2, 2, 3); backspace(getFirstEditor(), bId); checkEditorText("test", getFirstEditor()); }); redoFirstEditor(); checkEditorText("", getFirstEditor()); }