MCPcopy
hub / github.com/nwutils/nw-sample-apps / stringWidth

Function stringWidth

mini-code-edit/cm/lib/codemirror.js:1544–1548  ·  view source on GitHub ↗
(str)

Source from the content-addressed store, hash-verified

1542 }
1543
1544 function stringWidth(str) {
1545 measure.innerHTML = "<pre><span>x</span></pre>";
1546 measure.firstChild.firstChild.firstChild.nodeValue = str;
1547 return measure.firstChild.firstChild.offsetWidth || 10;
1548 }
1549 // These are used to go from pixel positions to character
1550 // positions, taking varying character widths into account.
1551 function charFromX(line, x) {

Callers 3

CodeMirrorFunction · 0.85
updateDisplayFunction · 0.85
charWidthFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected