void () { String text = """ 111 222 333 444 55 666 77"""; init(15, text); int foldStart = text.indexOf("5"); int foldEnd = text.indexOf("7"); addCollapsedFoldRegion(foldStart, foldEnd, "..."); int selectionStart = text.indexOf("2"); int selectionEnd = text.indexOf("4"); getEditor().getSelectionModel().setSelection(selectionStart, selectionEnd); delete(); assertEquals(new VisualPosition(1, 8), getEditor().offsetToVisualPosition(getEditor().getDocument().getTextLength() - 1)); }