LeafBlockWrapper (final int offset) { AdjustWhiteSpacesState state = new AdjustWhiteSpacesState(myWrapState, myProgressCallback, myReformatContext); state.prepare(); LeafBlockWrapper last = null; while (!state.isDone() && state.getCurrentBlock().getStartOffset() < offset) { last = state.getCurrentBlock(); state.doIteration(); } return state.getCurrentBlock() != null ? state.getCurrentBlock() : last; }