private static int updateMovedRegionStart(final Document document,
                                            int movedLineStart,
                                            final int offset,
                                            final @NotNull MoveInfo info,
                                            final boolean down) {
    final int line = document.getLineNumber(offset);
    final LineRange toMove = info.toMove;
    int delta = toMove.startLine - line;
    info.toMove = new LineRange(Math.min(line, toMove.startLine), toMove.endLine);

    // update moved range
    if (delta > 0 && !down) {
      final LineRange toMove2 = info.toMove2;
      info.toMove2 = new LineRange(toMove2.startLine - delta, toMove2.endLine - delta);
      movedLineStart = document.getLineStartOffset(toMove.startLine);
    }
    return movedLineStart;
  }
private static int updateMovedRegionStart(final Document document,
                                            int movedLineStart,
                                            final int offset,
                                            final @NotNull MoveInfo info,
                                            final boolean down)