@NotNull
  protected Runnable apply(@NotNull UnifiedDiffState builder,
                           CharSequence @NotNull [] texts,
                           @NotNull ProgressIndicator indicator) {
    final DocumentContent content1 = getContent1();
    final DocumentContent content2 = getContent2();

    HighlightersData highlightersData = BackgroundTaskUtil.tryComputeFast(___ -> {
      return ReadAction.compute(() -> {
        EditorHighlighter highlighter =
          buildHighlighter(myProject, myDocument, content1, content2,
                           texts[0], texts[1], builder.getRanges(),
                           builder.getText().length());
        UnifiedEditorRangeHighlighter rangeHighlighter =
          new UnifiedEditorRangeHighlighter(myProject, content1.getDocument(),
                                            content2.getDocument(), builder.getRanges());
        return new HighlightersData(highlighter, rangeHighlighter);
      });
    }, 500);

    LineNumberConvertor convertor1 = builder.getConvertor1();
    LineNumberConvertor convertor2 = builder.getConvertor2();
    List<LineRange> changedLines = builder.getChangedLines();
    boolean isContentsEqual = changedLines.isEmpty() && StringUtil.equals(texts[0], texts[1]);

    Side masterSide = builder.getMasterSide();
    FoldingModelSupport.Data foldingState = myFoldingModel.createState(changedLines, getFoldingModelSettings(),
                                                                       getDocument(masterSide), masterSide.select(convertor1, convertor2),
                                                                       StringUtil.countNewLines(builder.getText()) + 1);

    return () -> {
      myFoldingModel.updateContext(myRequest, getFoldingModelSettings());

      LineCol oldCaretPosition = LineCol.fromOffset(myDocument, myEditor.getCaretModel().getPrimaryCaret().getOffset());
      Pair<int[], Side> oldCaretLineTwoside = transferLineFromOneside(oldCaretPosition.line);


      clearDiffPresentation();


      if (isContentsEqual &&
          !DiffUtil.isUserDataFlagSet(DiffUserDataKeysEx.DISABLE_CONTENTS_EQUALS_NOTIFICATION, myContext, myRequest)) {
        myPanel.addNotification(TextDiffViewerUtil.createEqualContentsNotification(getContents()));
      }

      IntPredicate foldingLinePredicate = myFoldingModel.hideLineNumberPredicate(0);
      IntUnaryOperator merged1 = DiffUtil.mergeLineConverters(DiffUtil.getContentLineConvertor(getContent1()),
                                                              convertor1.createConvertor());
      IntUnaryOperator merged2 = DiffUtil.mergeLineConverters(DiffUtil.getContentLineConvertor(getContent2()),
                                                              convertor2.createConvertor());
      myEditor.getGutter().setLineNumberConverter(new DiffLineNumberConverter(foldingLinePredicate, merged1),
                                                  new DiffLineNumberConverter(foldingLinePredicate, merged2));

      ApplicationManager.getApplication().runWriteAction(() -> {
        myDuringOnesideDocumentModification = true;
        try {
          myDocument.setText(builder.getText());
        }
        finally {
          myDuringOnesideDocumentModification = false;
        }
      });

      DiffUtil.setEditorCodeStyle(myProject, myEditor, getContent(myMasterSide));

      List<RangeMarker> guarderRangeBlocks = new ArrayList<>();
      if (!myEditor.isViewer()) {
        for (UnifiedDiffChange change : builder.getChanges()) {
          LineRange range = myMasterSide.select(change.getInsertedRange(), change.getDeletedRange());
          if (range.isEmpty()) continue;
          TextRange textRange = DiffUtil.getLinesRange(myDocument, range.start, range.end);
          guarderRangeBlocks.add(createGuardedBlock(textRange.getStartOffset(), textRange.getEndOffset()));
        }
        int textLength = myDocument.getTextLength(); // there are 'fake' newline at the very end
        guarderRangeBlocks.add(createGuardedBlock(textLength, textLength));
      }

      myModel.setChanges(builder.getChanges(), isContentsEqual, guarderRangeBlocks, convertor1, convertor2, builder.getRanges());

      int newCaretLine = transferLineToOneside(oldCaretLineTwoside.second,
                                               oldCaretLineTwoside.second.select(oldCaretLineTwoside.first));
      myEditor.getCaretModel().moveToOffset(LineCol.toOffset(myDocument, newCaretLine, oldCaretPosition.column));

      myFoldingModel.install(foldingState, myRequest, getFoldingModelSettings());

      HighlightersData.apply(myProject, myEditor, highlightersData);
      myMarkupUpdater.resumeUpdate();

      myInitialScrollHelper.onRediff();

      myStatusPanel.update();
      myPanel.setGoodContent();

      myEditor.getGutterComponentEx().revalidateMarkup();
    };
  }
@NotNull
  protected Runnable apply(@NotNull UnifiedDiffState builder,
                           CharSequence @NotNull [] texts,
                           @NotNull ProgressIndicator indicator)