MCPcopy Create free account
hub / github.com/sql-js/sql.js / charWidth

Function charWidth

GUI/codemirror/lib/codemirror.js:1868–1876  ·  view source on GitHub ↗
(display)

Source from the content-addressed store, hash-verified

1866
1867 // Compute the default character width.
1868 function charWidth(display) {
1869 if (display.cachedCharWidth != null) return display.cachedCharWidth;
1870 var anchor = elt("span", "xxxxxxxxxx");
1871 var pre = elt("pre", [anchor]);
1872 removeChildrenAndAdd(display.measure, pre);
1873 var rect = anchor.getBoundingClientRect(), width = (rect.right - rect.left) / 10;
1874 if (width > 2) display.cachedCharWidth = width;
1875 return width || 10;
1876 }
1877
1878 // OPERATIONS
1879

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

Used in the wild real call sites across dependent graphs

searching dependent graphs…