void (@NotNull Editor editor, int startLine, int endLine, @NotNull List<? extends DiffFragment> wordDiff, @NotNull Disposable parentDisposable) { TextRange currentTextRange = DiffUtil.getLinesRange(editor.getDocument(), startLine, endLine); DiffDrawUtil.setupLayeredRendering(editor, startLine, endLine, DiffDrawUtil.LAYER_PRIORITY_LST, parentDisposable); int currentStartOffset = currentTextRange.getStartOffset(); List<RangeHighlighter> highlighters = new ArrayList<>(); highlighters.addAll( new DiffDrawUtil.LineHighlighterBuilder(editor, startLine, endLine, TextDiffType.MODIFIED) .withLayerPriority(DiffDrawUtil.LAYER_PRIORITY_LST) .withIgnored(true) .withHideStripeMarkers(true) .withHideGutterMarkers(true) .done()); for (DiffFragment fragment : wordDiff) { int currentStart = currentStartOffset + fragment.getStartOffset2(); int currentEnd = currentStartOffset + fragment.getEndOffset2(); TextDiffType type = getDiffType(fragment); highlighters.addAll(new DiffDrawUtil.InlineHighlighterBuilder(editor, currentStart, currentEnd, type) .withLayerPriority(DiffDrawUtil.LAYER_PRIORITY_LST) .done()); } Disposer.register(parentDisposable, () -> highlighters.forEach(RangeMarker::dispose)); }