MCPcopy
hub / github.com/witheve/Eve / charWidth

Function charWidth

src/codemirror.js:2988–2996  ·  view source on GitHub ↗
(display)

Source from the content-addressed store, hash-verified

2986
2987 // Compute the default character width.
2988 function charWidth(display) {
2989 if (display.cachedCharWidth != null) return display.cachedCharWidth;
2990 var anchor = elt("span", "xxxxxxxxxx");
2991 var pre = elt("pre", [anchor]);
2992 removeChildrenAndAdd(display.measure, pre);
2993 var rect = anchor.getBoundingClientRect(), width = (rect.right - rect.left) / 10;
2994 if (width > 2) display.cachedCharWidth = width;
2995 return width || 10;
2996 }
2997
2998 // OPERATIONS
2999

Callers 5

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

Calls 2

eltFunction · 0.85
removeChildrenAndAddFunction · 0.85

Tested by

no test coverage detected