void (MultiMap<Alignment, LeafBlockWrapper> blocks) { for (Alignment alignment : blocks.keySet()) { AlignmentImpl alignmentImpl = (AlignmentImpl)alignment; if (!alignmentImpl.isAllowBackwardShift()) continue; Set<LeafBlockWrapper> toRealign = alignmentImpl.getOffsetResponsibleBlocks(); arrangeSpaces(toRealign); LeafBlockWrapper rightMostBlock = getRightMostBlock(toRealign); int maxSpacesBeforeBlock = rightMostBlock.getNumberOfSymbolsBeforeBlock().getTotalSpaces(); int rightMostBlockLine = myDocument.getLineNumber(rightMostBlock.getStartOffset()); for (LeafBlockWrapper block : toRealign) { int currentBlockLine = myDocument.getLineNumber(block.getStartOffset()); if (currentBlockLine == rightMostBlockLine) continue; int blockIndent = block.getNumberOfSymbolsBeforeBlock().getTotalSpaces(); int delta = maxSpacesBeforeBlock - blockIndent; if (delta > 0) { int newSpaces = block.getWhiteSpace().getTotalSpaces() + delta; adjustSpacingToKeepAligned(block, newSpaces); } } } }