MCPcopy
hub / github.com/csev/py4e / textHeight

Function textHeight

tools/pythonauto/static/codemirrorepl/codemirror.js:1832–1849  ·  view source on GitHub ↗
(display)

Source from the content-addressed store, hash-verified

1830 var measureText;
1831 // Compute the default text height.
1832 function textHeight(display) {
1833 if (display.cachedTextHeight != null) return display.cachedTextHeight;
1834 if (measureText == null) {
1835 measureText = elt("pre");
1836 // Measure a bunch of lines, for browsers that compute
1837 // fractional heights.
1838 for (var i = 0; i < 49; ++i) {
1839 measureText.appendChild(document.createTextNode("x"));
1840 measureText.appendChild(elt("br"));
1841 }
1842 measureText.appendChild(document.createTextNode("x"));
1843 }
1844 removeChildrenAndAdd(display.measure, measureText);
1845 var height = measureText.offsetHeight / 50;
1846 if (height > 3) display.cachedTextHeight = height;
1847 removeChildren(display.measure);
1848 return height || 1;
1849 }
1850
1851 // Compute the default character width.
1852 function charWidth(display) {

Callers 5

estimateHeightFunction · 0.70
updateHeightsInViewportFunction · 0.70
calculateScrollPosFunction · 0.70
findPosVFunction · 0.70
codemirror.jsFile · 0.70

Calls 4

eltFunction · 0.70
removeChildrenAndAddFunction · 0.70
removeChildrenFunction · 0.70
appendChildMethod · 0.45

Tested by

no test coverage detected