SimpleDiffRequest () { SimpleDiffRequest request = super.createRequest(); ThreeSide currentSide = getCurrentSide(); LogicalPosition currentPosition = DiffUtil.getCaretPosition(getCurrentEditor()); // we won't use DiffUserDataKeysEx.EDITORS_CARET_POSITION to avoid desync scroll position (as they can point to different places) // TODO: pass EditorsVisiblePositions in case if view was scrolled without changing caret position ? if (currentSide == mySide1) { request.putUserData(DiffUserDataKeys.SCROLL_TO_LINE, Pair.create(Side.LEFT, currentPosition.line)); } else if (currentSide == mySide2) { request.putUserData(DiffUserDataKeys.SCROLL_TO_LINE, Pair.create(Side.RIGHT, currentPosition.line)); } else { LogicalPosition position1 = transferPosition(currentSide, mySide1, currentPosition); LogicalPosition position2 = transferPosition(currentSide, mySide2, currentPosition); request.putUserData(DiffUserDataKeysEx.EDITORS_CARET_POSITION, new LogicalPosition[]{position1, position2}); } return request; }