void () { initText("long long line"); configureSoftWraps(6); verifySoftWrapPositions(5, 10); JViewport viewport = ((EditorEx)getEditor()).getScrollPane().getViewport(); Dimension normalSize = viewport.getExtentSize(); viewport.setExtentSize(new Dimension(0, 0)); runWriteCommand(() -> getEditor().getDocument().deleteString(5, 14)); viewport.setExtentSize(normalSize); verifySoftWrapPositions(); }