List<RangeHighlighter> (@NotNull Editor editor, @NotNull LineRange deleted, @NotNull LineRange inserted, boolean excluded, boolean skipped, @Nullable List<? extends DiffFragment> innerFragments) { boolean ignored = innerFragments != null; List<RangeHighlighter> list = new ArrayList<>(); if (!inserted.isEmpty() && !deleted.isEmpty()) { list.addAll(createHighlighter(editor, deleted.start, deleted.end, TextDiffType.DELETED, ignored, skipped, excluded)); list.addAll(createHighlighter(editor, inserted.start, inserted.end, TextDiffType.INSERTED, ignored, skipped, excluded)); } else if (!inserted.isEmpty()) { list.addAll(createHighlighter(editor, inserted.start, inserted.end, TextDiffType.INSERTED, ignored, skipped, excluded)); } else if (!deleted.isEmpty()) { list.addAll(createHighlighter(editor, deleted.start, deleted.end, TextDiffType.DELETED, ignored, skipped, excluded)); } if (innerFragments != null && !skipped) { int deletedStartOffset = editor.getDocument().getLineStartOffset(deleted.start); int insertedStartOffset = editor.getDocument().getLineStartOffset(inserted.start); for (DiffFragment fragment : innerFragments) { int deletedWordStart = deletedStartOffset + fragment.getStartOffset1(); int deletedWordEnd = deletedStartOffset + fragment.getEndOffset1(); list.addAll(createInlineHighlighter(editor, deletedWordStart, deletedWordEnd, TextDiffType.DELETED)); int insertedWordStart = insertedStartOffset + fragment.getStartOffset2(); int insertedWordEnd = insertedStartOffset + fragment.getEndOffset2(); list.addAll(createInlineHighlighter(editor, insertedWordStart, insertedWordEnd, TextDiffType.INSERTED)); } } return list; }