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

Function lineLength

static/editor.md/lib/codemirror/lib/codemirror.js:329–345  ·  view source on GitHub ↗
(line)

Source from the content-addressed store, hash-verified

327 // collapsed ranges (see markText) that might hide parts, and join
328 // other lines onto it.
329 function lineLength(line) {
330 if (line.height == 0) return 0;
331 var len = line.text.length, merged, cur = line;
332 while (merged = collapsedSpanAtStart(cur)) {
333 var found = merged.find(0, true);
334 cur = found.from.line;
335 len += found.from.ch - found.to.ch;
336 }
337 cur = line;
338 while (merged = collapsedSpanAtEnd(cur)) {
339 var found = merged.find(0, true);
340 len -= cur.text.length - found.from.ch;
341 cur = found.to.line;
342 len += cur.text.length - found.to.ch;
343 }
344 return len;
345 }
346
347 // Find the longest line in the document.
348 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