void () { String text = """ class Test { public void foo() { System.out.println("test"); } } abcde"""; init(40, text); int offset = text.indexOf("abcde"); getEditor().getSelectionModel().setSelection(offset, text.length()); delete(); assertEquals(new VisualPosition(5, 0), getEditor().getCaretModel().getVisualPosition()); }