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

Function textHeight

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

Source from the content-addressed store, hash-verified

1646
1647 var cachedHeight, cachedHeightFor, measureText;
1648 function textHeight() {
1649 if (measureText == null) {
1650 measureText = "<pre>";
1651 for (var i = 0; i < 49; ++i) measureText += "x<br/>";
1652 measureText += "x</pre>";
1653 }
1654 var offsetHeight = lineDiv.clientHeight;
1655 if (offsetHeight == cachedHeightFor) return cachedHeight;
1656 cachedHeightFor = offsetHeight;
1657 measure.innerHTML = measureText;
1658 cachedHeight = measure.firstChild.offsetHeight / 50 || 1;
1659 measure.innerHTML = "";
1660 return cachedHeight;
1661 }
1662 var cachedWidth, cachedWidthFor = 0;
1663 function charWidth() {
1664 if (scroller.clientWidth == cachedWidthFor) return cachedWidth;

Callers 8

CodeMirrorFunction · 0.85
updateLinesNoUndoFunction · 0.85
visibleLinesFunction · 0.85
updateDisplayFunction · 0.85
updateSelectionFunction · 0.85
moveVFunction · 0.85
localCoordsFunction · 0.85
coordsCharFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected