void () { initText("long long line<caret>"); configureSoftWraps(12); DocumentEx document = (DocumentEx)getEditor().getDocument(); runWriteCommand(() -> DocumentUtil.executeInBulk(document, ()-> document.replaceString(4, 5, "-"))); assertEquals(new VisualPosition(1, 5), getEditor().getCaretModel().getVisualPosition()); }