void (@NotNull ApplyPatchChange change, @NotNull Side masterSide, boolean forceScroll) { if (change.getResultRange() == null) { DiffUtil.moveCaret(myPatchEditor, change.getPatchRange().start); myPatchEditor.getScrollingModel().scrollToCaret(forceScroll ? ScrollType.CENTER : ScrollType.MAKE_VISIBLE); } else { LineRange resultRange = change.getResultRange(); LineRange patchRange = change.getPatchAffectedRange(); int topShift = -1; if (!forceScroll) { int masterLine = masterSide.select(resultRange.start, patchRange.start); EditorEx masterEditor = masterSide.select(myResultEditor, myPatchEditor); int targetY = masterEditor.logicalPositionToXY(new LogicalPosition(masterLine, 0)).y; int scrollOffset = masterEditor.getScrollingModel().getVerticalScrollOffset(); topShift = targetY - scrollOffset; } int[] offsets = SyncScrollSupport.getTargetOffsets(myResultEditor, myPatchEditor, resultRange.start, resultRange.end, patchRange.start, patchRange.end, topShift); DiffUtil.moveCaret(myResultEditor, resultRange.start); DiffUtil.moveCaret(myPatchEditor, patchRange.start); DiffUtil.scrollToPoint(myResultEditor, new Point(0, offsets[0]), false); DiffUtil.scrollToPoint(myPatchEditor, new Point(0, offsets[1]), false); } }