(cm)
| 229 | } |
| 230 | |
| 231 | function estimateHeight(cm) { |
| 232 | var th = textHeight(cm.display), wrapping = cm.options.lineWrapping; |
| 233 | var perLine = wrapping && Math.max(5, cm.display.scroller.clientWidth / charWidth(cm.display) - 3); |
| 234 | return function(line) { |
| 235 | if (lineIsHidden(cm.doc, line)) |
| 236 | return 0; |
| 237 | else if (wrapping) |
| 238 | return (Math.ceil(line.text.length / perLine) || 1) * th; |
| 239 | else |
| 240 | return th; |
| 241 | }; |
| 242 | } |
| 243 | |
| 244 | function estimateLineHeights(cm) { |
| 245 | var doc = cm.doc, est = estimateHeight(cm); |
no test coverage detected