MCPcopy Index your code
hub / github.com/csev/py4e / charWidth

Function charWidth

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

Source from the content-addressed store, hash-verified

1850
1851 // Compute the default character width.
1852 function charWidth(display) {
1853 if (display.cachedCharWidth != null) return display.cachedCharWidth;
1854 var anchor = elt("span", "xxxxxxxxxx");
1855 var pre = elt("pre", [anchor]);
1856 removeChildrenAndAdd(display.measure, pre);
1857 var rect = anchor.getBoundingClientRect(), width = (rect.right - rect.left) / 10;
1858 if (width > 2) display.cachedCharWidth = width;
1859 return width || 10;
1860 }
1861
1862 // OPERATIONS
1863

Callers 5

estimateHeightFunction · 0.70
measureCharInnerFunction · 0.70
estimateCoordsFunction · 0.70
posFromMouseFunction · 0.70
codemirror.jsFile · 0.70

Calls 2

eltFunction · 0.70
removeChildrenAndAddFunction · 0.70

Tested by

no test coverage detected