MCPcopy
hub / github.com/witheve/Eve / findStartLine

Function findStartLine

src/codemirror.js:2488–2502  ·  view source on GitHub ↗
(cm, n, precise)

Source from the content-addressed store, hash-verified

2486 // smallest indentation, which tends to need the least context to
2487 // parse correctly.
2488 function findStartLine(cm, n, precise) {
2489 var minindent, minline, doc = cm.doc;
2490 var lim = precise ? -1 : n - (cm.doc.mode.innerMode ? 1000 : 100);
2491 for (var search = n; search > lim; --search) {
2492 if (search <= doc.first) return doc.first;
2493 var line = getLine(doc, search - 1);
2494 if (line.stateAfter && (!precise || search <= doc.frontier)) return search;
2495 var indented = countColumn(line.text, null, cm.options.tabSize);
2496 if (minline == null || minindent > indented) {
2497 minline = search - 1;
2498 minindent = indented;
2499 }
2500 }
2501 return minline;
2502 }
2503
2504 function getStateBefore(cm, n, precise) {
2505 var doc = cm.doc, display = cm.display;

Callers 1

getStateBeforeFunction · 0.85

Calls 1

getLineFunction · 0.85

Tested by

no test coverage detected