MCPcopy Create free account
hub / github.com/TruthHun/BookStack / lineLength

Function lineLength

static/mergely/lib/codemirror.js:335–351  ·  view source on GitHub ↗
(line)

Source from the content-addressed store, hash-verified

333 // collapsed ranges (see markText) that might hide parts, and join
334 // other lines onto it.
335 function lineLength(line) {
336 if (line.height == 0) return 0;
337 var len = line.text.length, merged, cur = line;
338 while (merged = collapsedSpanAtStart(cur)) {
339 var found = merged.find(0, true);
340 cur = found.from.line;
341 len += found.from.ch - found.to.ch;
342 }
343 cur = line;
344 while (merged = collapsedSpanAtEnd(cur)) {
345 var found = merged.find(0, true);
346 len -= cur.text.length - found.from.ch;
347 cur = found.to.line;
348 len += cur.text.length - found.to.ch;
349 }
350 return len;
351 }
352
353 // Find the longest line in the document.
354 function findMaxLine(cm) {

Callers 3

findMaxLineFunction · 0.70
codemirror.jsFile · 0.70

Calls 2

collapsedSpanAtStartFunction · 0.70
collapsedSpanAtEndFunction · 0.70

Tested by

no test coverage detected