void (@NotNull Editor editor, int startLine, int endLine, int layerPriority, @NotNull Disposable disposable) { if (startLine == endLine) return; editor.putUserData(EDITOR_WITH_HIGH_PRIORITY_RENDERER, true); TextAttributes attributes = new TextAttributes(); attributes.setBackgroundColor(editor.getColorsScheme().getDefaultBackground()); TextRange offsets = DiffUtil.getLinesRange(editor.getDocument(), startLine, endLine); RangeHighlighter highlighter = editor.getMarkupModel() .addRangeHighlighter(offsets.getStartOffset(), offsets.getEndOffset(), getLayer(BASE_LAYER, layerPriority), attributes, HighlighterTargetArea.LINES_IN_RANGE); highlighter.setCustomRenderer(new DiffLayeredRendererMarker()); Disposer.register(disposable, () -> { editor.putUserData(EDITOR_WITH_HIGH_PRIORITY_RENDERER, null); highlighter.dispose(); }); }