void () { init(100, "aaa\nbbb\nccc\nddd"); addCollapsedFoldRegion(4, 8, "..."); addCollapsedFoldRegion(13, 15, "..."); WriteCommandAction.runWriteCommandAction(getProject(), () -> getEditor().getDocument().insertString(10, "C")); // verify that cached layout data is intact after document change and position recalculation is done correctly assertEquals(new LogicalPosition(0, 0), getEditor().visualToLogicalPosition(new VisualPosition(0, 0))); }