MCPcopy
hub / github.com/csev/py4e / findStartLine

Function findStartLine

tools/pythonauto/static/codemirrorepl/codemirror.js:1405–1419  ·  view source on GitHub ↗
(cm, n, precise)

Source from the content-addressed store, hash-verified

1403 // smallest indentation, which tends to need the least context to
1404 // parse correctly.
1405 function findStartLine(cm, n, precise) {
1406 var minindent, minline, doc = cm.doc;
1407 var lim = precise ? -1 : n - (cm.doc.mode.innerMode ? 1000 : 100);
1408 for (var search = n; search > lim; --search) {
1409 if (search <= doc.first) return doc.first;
1410 var line = getLine(doc, search - 1);
1411 if (line.stateAfter && (!precise || search <= doc.frontier)) return search;
1412 var indented = countColumn(line.text, null, cm.options.tabSize);
1413 if (minline == null || minindent > indented) {
1414 minline = search - 1;
1415 minindent = indented;
1416 }
1417 }
1418 return minline;
1419 }
1420
1421 function getStateBefore(cm, n, precise) {
1422 var doc = cm.doc, display = cm.display;

Callers 1

getStateBeforeFunction · 0.70

Calls 2

getLineFunction · 0.70
countColumnFunction · 0.70

Tested by

no test coverage detected