List<Range> (@NotNull Document document, @NotNull Change change) { String conventBefore = getRevisionedContentFrom(change.getBeforeRevision()); if (conventBefore == null) return null; String contentAfter = getRevisionedContentFrom(change.getAfterRevision()); if (contentAfter == null) return null; CharSequence beforeText = fixLineSeparators(conventBefore); CharSequence afterText = fixLineSeparators(contentAfter); CharSequence localText = document.getImmutableCharSequence(); LineOffsets beforeLineOffsets = LineOffsetsUtil.create(beforeText); LineOffsets afterLineOffsets = LineOffsetsUtil.create(afterText); LineOffsets localLineOffsets = LineOffsetsUtil.create(document); FairDiffIterable committedLines = RangesBuilder.compareLines(beforeText, afterText, beforeLineOffsets, afterLineOffsets); FairDiffIterable localLines = RangesBuilder.compareLines(afterText, localText, afterLineOffsets, localLineOffsets); ChangedRangesShifter builder = new ChangedRangesShifter(); List<com.intellij.diff.util.Range> ranges = builder.execute(committedLines, localLines); return ContainerUtil.map(ranges, it -> new Range(it.start2, it.end2, it.start1, it.end1, null)); }