MCPcopy Create free account
hub / github.com/sql-js/sql.js / findStartLine

Function findStartLine

GUI/codemirror/lib/codemirror.js:1420–1434  ·  view source on GitHub ↗
(cm, n, precise)

Source from the content-addressed store, hash-verified

1418 // smallest indentation, which tends to need the least context to
1419 // parse correctly.
1420 function findStartLine(cm, n, precise) {
1421 var minindent, minline, doc = cm.doc;
1422 var lim = precise ? -1 : n - (cm.doc.mode.innerMode ? 1000 : 100);
1423 for (var search = n; search > lim; --search) {
1424 if (search <= doc.first) return doc.first;
1425 var line = getLine(doc, search - 1);
1426 if (line.stateAfter && (!precise || search <= doc.frontier)) return search;
1427 var indented = countColumn(line.text, null, cm.options.tabSize);
1428 if (minline == null || minindent > indented) {
1429 minline = search - 1;
1430 minindent = indented;
1431 }
1432 }
1433 return minline;
1434 }
1435
1436 function getStateBefore(cm, n, precise) {
1437 var doc = cm.doc, display = cm.display;

Callers 1

getStateBeforeFunction · 0.85

Calls 1

getLineFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…