MCPcopy Index your code
hub / github.com/ronreiter/interactive-tutorials / lineLength

Function lineLength

static/js/codemirror/codemirror.js:270–286  ·  view source on GitHub ↗
(doc, line)

Source from the content-addressed store, hash-verified

268 }
269
270 function lineLength(doc, line) {
271 if (line.height == 0) return 0;
272 var len = line.text.length, merged, cur = line;
273 while (merged = collapsedSpanAtStart(cur)) {
274 var found = merged.find();
275 cur = getLine(doc, found.from.line);
276 len += found.from.ch - found.to.ch;
277 }
278 cur = line;
279 while (merged = collapsedSpanAtEnd(cur)) {
280 var found = merged.find();
281 len -= cur.text.length - found.from.ch;
282 cur = getLine(doc, found.to.line);
283 len += cur.text.length - found.to.ch;
284 }
285 return len;
286 }
287
288 function computeMaxLength(cm) {
289 var d = cm.display, doc = cm.doc;

Callers 3

computeMaxLengthFunction · 0.70
codemirror.jsFile · 0.70

Calls 4

collapsedSpanAtStartFunction · 0.85
getLineFunction · 0.85
collapsedSpanAtEndFunction · 0.85
findMethod · 0.45

Tested by

no test coverage detected