code: function estimateHeight(cm) {
      var th = textHeight(cm.display), wrapping = cm.options.lineWrapping;
      var perLine = wrapping && Math.max(5, cm.display.scroller.clientWidth / charWidth(cm.display) - 3);
      return function(line) {
        if (lineIsHidden(cm.doc, line)) return 0;
  
        var widgetsHeight = 0;
        if (line.widgets) for (var i = 0; i < line.widgets.length; i++) {
          if (line.widgets[i].height) widgetsHeight += line.widgets[i].height;
        }
  
        if (wrapping)
          return widgetsHeight + (Math.ceil(line.text.length / perLine) || 1) * th;
        else
          return widgetsHeight + th;
      };
    }
docs: Returns a function that estimates the height of a line, to use as first approximation until the line becomes visible (and is thus properly measurable).