BitSet (@NotNull List<? extends Range> ranges) { BitSet changedLines = new BitSet(); for (Range range : ranges) { if (range.hasLines()) { changedLines.set(range.getLine1(), range.getLine2()); } else { // mark unchanged lines around deleted lines as modified changedLines.set(Math.max(0, range.getLine1() - 1), range.getLine1() + 1); } } return changedLines; }