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

Function findStartLine

static/editor.md/lib/codemirror/lib/codemirror.js:2376–2390  ·  view source on GitHub ↗
(cm, n, precise)

Source from the content-addressed store, hash-verified

2374 // smallest indentation, which tends to need the least context to
2375 // parse correctly.
2376 function findStartLine(cm, n, precise) {
2377 var minindent, minline, doc = cm.doc;
2378 var lim = precise ? -1 : n - (cm.doc.mode.innerMode ? 1000 : 100);
2379 for (var search = n; search > lim; --search) {
2380 if (search <= doc.first) return doc.first;
2381 var line = getLine(doc, search - 1);
2382 if (line.stateAfter && (!precise || search <= doc.frontier)) return search;
2383 var indented = countColumn(line.text, null, cm.options.tabSize);
2384 if (minline == null || minindent > indented) {
2385 minline = search - 1;
2386 minindent = indented;
2387 }
2388 }
2389 return minline;
2390 }
2391
2392 function getStateBefore(cm, n, precise) {
2393 var doc = cm.doc, display = cm.display;

Callers 1

getStateBeforeFunction · 0.70

Calls 1

getLineFunction · 0.70

Tested by

no test coverage detected