void () { initText("a<selection>bcdef<caret></selection>g\n" + "a<selection>bcdef<caret></selection>g"); runWriteCommand(() -> { DocumentEx document = (DocumentEx)getEditor().getDocument(); DocumentUtil.executeInBulk(document, ()-> { // delete selected text document.deleteString(1, 6); document.deleteString(4, 9); }); }); checkResultByText("a<caret>g\n" + "a<caret>g"); }