code: function resolveScrollToPos(cm) {
      var range = cm.curOp.scrollToPos;
      if (range) {
        cm.curOp.scrollToPos = null;
        var from = estimateCoords(cm, range.from), to = estimateCoords(cm, range.to);
        var sPos = calculateScrollPos(cm, Math.min(from.left, to.left),
                                      Math.min(from.top, to.top) - range.margin,
                                      Math.max(from.right, to.right),
                                      Math.max(from.bottom, to.bottom) + range.margin);
        cm.scrollTo(sPos.scrollLeft, sPos.scrollTop);
      }
    }
docs: When an operation has its scrollToPos property set, and another scroll action is applied before the end of the operation, this 'simulates' scrolling that position into view in a cheap way, so that the effect of intermediate scroll commands is not ignored.