void () { initText("abc def ghi"); configureSoftWraps(3); JViewport viewport = ((EditorEx)getEditor()).getScrollPane().getViewport(); viewport.setExtentSize(new Dimension()); // emulate editor becoming invisible runWriteCommand(() -> { Document document = getEditor().getDocument(); document.deleteString(0, document.getTextLength()); }); viewport.setExtentSize(new Dimension(1000, 1000)); // editor becomes visible verifySoftWrapPositions(); }