MCPcopy Index your code
hub / github.com/csev/py4e / measureLineWidth

Function measureLineWidth

tools/pythonauto/static/codemirror/codemirror.js:1150–1164  ·  view source on GitHub ↗
(cm, line)

Source from the content-addressed store, hash-verified

1148 }
1149
1150 function measureLineWidth(cm, line) {
1151 var hasBadSpan = false;
1152 if (line.markedSpans) for (var i = 0; i < line.markedSpans; ++i) {
1153 var sp = line.markedSpans[i];
1154 if (sp.collapsed && (sp.to == null || sp.to == line.text.length)) hasBadSpan = true;
1155 }
1156 var cached = !hasBadSpan && findCachedMeasurement(cm, line);
1157 if (cached || line.text.length >= cm.options.crudeMeasuringFrom)
1158 return measureChar(cm, line, line.text.length, cached && cached.measure, "right").right;
1159
1160 var pre = buildLineContent(cm, line, null, true).pre;
1161 var end = pre.appendChild(zeroWidthElement(cm.display.measure));
1162 removeChildrenAndAdd(cm.display.measure, pre);
1163 return getRect(end).right - getRect(cm.display.lineDiv).left;
1164 }
1165
1166 function clearCaches(cm) {
1167 cm.display.measureLineCache.length = cm.display.measureLineCachePos = 0;

Callers 1

endOperationFunction · 0.85

Calls 7

findCachedMeasurementFunction · 0.85
getRectFunction · 0.85
measureCharFunction · 0.70
buildLineContentFunction · 0.70
zeroWidthElementFunction · 0.70
removeChildrenAndAddFunction · 0.70
appendChildMethod · 0.45

Tested by

no test coverage detected