void () { initText("some text"); DocumentEx document = (DocumentEx)getEditor().getDocument(); runWriteCommand(() -> { DocumentUtil.executeInBulk(document, ()-> document.replaceString(4, 5, "-")); getEditor().getCaretModel().moveToOffset(9); DocumentUtil.executeInBulk(document, ()-> document.replaceString(4, 5, "+")); }); checkResultByText("some+text<caret>"); }