void () { // There was a problem that removing all text from the last document line corrupted soft wraps cache. String text = "Line1\n" + "Long line2 that is expected to be soft-wrapped<caret>"; init(20, text); List<SoftWrap> softWrapsBeforeModification = new ArrayList<>(getSoftWrapModel().getRegisteredSoftWraps()); assertFalse(softWrapsBeforeModification.isEmpty()); int offset = getEditor().getCaretModel().getOffset(); VisualPosition positionBeforeModification = getEditor().offsetToVisualPosition(offset); type("\n123"); getEditor().getSelectionModel().setSelection(offset + 1, getEditor().getDocument().getTextLength()); delete(); assertEquals(softWrapsBeforeModification, getSoftWrapModel().getRegisteredSoftWraps()); assertEquals(positionBeforeModification, getEditor().offsetToVisualPosition(offset)); }