void () { String text = """ line1 line2 line3 line4 line5 this is long line that is expected to be soft-wrapped line6"""; init(15, text); assertTrue(!getSoftWrapModel().getRegisteredSoftWraps().isEmpty()); int offsetAfterSingleLineFoldRegion = text.indexOf("line2") - 1; int lineAfterSingleLineFoldRegion = getEditor().offsetToVisualPosition(offsetAfterSingleLineFoldRegion).line; int offsetAfterMultiLineFoldRegion = text.indexOf("this") - 1; int lineAfterMultiLineFoldRegion = getEditor().offsetToVisualPosition(offsetAfterMultiLineFoldRegion).line; int offsetAfterSoftWrap = text.indexOf("line6") - 1; VisualPosition beforePositionAfterSoftWrap = getEditor().offsetToVisualPosition(offsetAfterSoftWrap); // Add single-line fold region which placeholder text is long enough to exceed visual area width. addCollapsedFoldRegion(2, offsetAfterSingleLineFoldRegion, "this is a very long placeholder for the single-line fold region"); assertEquals(lineAfterSingleLineFoldRegion + 1, getEditor().offsetToVisualPosition(offsetAfterSingleLineFoldRegion).line); lineAfterSingleLineFoldRegion++; assertEquals(lineAfterMultiLineFoldRegion + 1, getEditor().offsetToVisualPosition(offsetAfterMultiLineFoldRegion).line); lineAfterMultiLineFoldRegion++; beforePositionAfterSoftWrap = new VisualPosition(beforePositionAfterSoftWrap.line + 1, beforePositionAfterSoftWrap.column); assertEquals(beforePositionAfterSoftWrap, getEditor().offsetToVisualPosition(offsetAfterSoftWrap)); // Add multi-line fold region which placeholder is also long enough to exceed visual area width. addCollapsedFoldRegion(text.indexOf("line2") + 2, offsetAfterMultiLineFoldRegion, "long enough placeholder for multi-line fold region"); assertEquals(lineAfterSingleLineFoldRegion, getEditor().offsetToVisualPosition(offsetAfterSingleLineFoldRegion).line); assertEquals(lineAfterMultiLineFoldRegion - 2, getEditor().offsetToVisualPosition(offsetAfterMultiLineFoldRegion).line); beforePositionAfterSoftWrap = new VisualPosition(beforePositionAfterSoftWrap.line - 2, beforePositionAfterSoftWrap.column); assertEquals(beforePositionAfterSoftWrap, getEditor().offsetToVisualPosition(offsetAfterSoftWrap)); }