MCPcopy Index your code
hub / github.com/ronreiter/interactive-tutorials / charWidth

Function charWidth

static/js/codemirror/codemirror.js:1200–1208  ·  view source on GitHub ↗
(display)

Source from the content-addressed store, hash-verified

1198 }
1199
1200 function charWidth(display) {
1201 if (display.cachedCharWidth != null) return display.cachedCharWidth;
1202 var anchor = elt("span", "x");
1203 var pre = elt("pre", [anchor]);
1204 removeChildrenAndAdd(display.measure, pre);
1205 var width = anchor.offsetWidth;
1206 if (width > 2) display.cachedCharWidth = width;
1207 return width || 10;
1208 }
1209
1210 // OPERATIONS
1211

Callers 1

estimateHeightFunction · 0.85

Calls 2

eltFunction · 0.85
removeChildrenAndAddFunction · 0.85

Tested by

no test coverage detected