void (int lineCount, List<? super RangeMarker> markers) { for (int i = 0; i < lineCount; i++) { myIndicator.checkCanceled(); myIndicator.setFraction(0.3 + 0.2 * i / lineCount); JoinLinesOffsets offsets = new JoinLinesOffsets(myDoc, myLine); if (offsets.lastNonSpaceOffsetInStartLine == myDoc.getLineStartOffset(myLine)) { myDoc.deleteString(myDoc.getLineStartOffset(myLine), offsets.firstNonSpaceOffsetInNextLine); myManager.commitDocument(myDoc); int indent = myStyleManager.adjustLineIndent(myFile, myLine == 0 ? 0 : myDoc.getLineStartOffset(myLine)); if (myCaretRestoreOffset == CANNOT_JOIN) { myCaretRestoreOffset = indent; } continue; } myDoc.deleteString(offsets.lineEndOffset, offsets.lineEndOffset + myDoc.getLineSeparatorLength(myLine)); RangeMarker marker = myDoc.createRangeMarker(offsets.lineEndOffset, offsets.lineEndOffset); marker.setGreedyToLeft(true); marker.setGreedyToRight(true); markers.add(marker); } Collections.reverse(markers); myManager.commitDocument(myDoc); }