MCPcopy
hub / github.com/csev/py4e / measureCharPrepared

Function measureCharPrepared

tools/pythonauto/static/codemirrorepl/codemirror.js:1538–1554  ·  view source on GitHub ↗
(cm, prepared, ch, bias)

Source from the content-addressed store, hash-verified

1536 // Given a prepared measurement object, measures the position of an
1537 // actual character (or fetches it from the cache).
1538 function measureCharPrepared(cm, prepared, ch, bias) {
1539 if (prepared.before) ch = -1;
1540 var key = ch + (bias || ""), found;
1541 if (prepared.cache.hasOwnProperty(key)) {
1542 found = prepared.cache[key];
1543 } else {
1544 if (!prepared.rect)
1545 prepared.rect = prepared.view.text.getBoundingClientRect();
1546 if (!prepared.hasHeights) {
1547 ensureLineHeights(cm, prepared.view, prepared.rect);
1548 prepared.hasHeights = true;
1549 }
1550 found = measureCharInner(cm, prepared, ch, bias);
1551 if (!found.bogus) prepared.cache[key] = found;
1552 }
1553 return {left: found.left, right: found.right, top: found.top, bottom: found.bottom};
1554 }
1555
1556 var nullRect = {left: 0, right: 0, top: 0, bottom: 0};
1557

Callers 2

measureCharFunction · 0.85
getFunction · 0.85

Calls 2

ensureLineHeightsFunction · 0.85
measureCharInnerFunction · 0.85

Tested by

no test coverage detected