LogicalPosition (@NotNull ThreeSide baseSide, @NotNull ThreeSide targetSide, @NotNull LogicalPosition position) { if (mySyncScrollSupport == null) return position; if (baseSide == targetSide) return position; SyncScrollSupport.SyncScrollable scrollable12 = mySyncScrollSupport.getScrollable12(); SyncScrollSupport.SyncScrollable scrollable23 = mySyncScrollSupport.getScrollable23(); int baseLine; // line number in BASE if (baseSide == ThreeSide.LEFT) { baseLine = scrollable12.transfer(Side.LEFT, position.line); } else if (baseSide == ThreeSide.RIGHT) { baseLine = scrollable23.transfer(Side.RIGHT, position.line); } else { baseLine = position.line; } int targetLine; if (targetSide == ThreeSide.LEFT) { targetLine = scrollable12.transfer(Side.RIGHT, baseLine); } else if (targetSide == ThreeSide.RIGHT) { targetLine = scrollable23.transfer(Side.LEFT, baseLine); } else { targetLine = baseLine; } return new LogicalPosition(targetLine, position.column); }