MCPcopy Index your code
hub / github.com/csev/py4e / findStartLine

Function findStartLine

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

Source from the content-addressed store, hash-verified

951 // smallest indentation, which tends to need the least context to
952 // parse correctly.
953 function findStartLine(cm, n, precise) {
954 var minindent, minline, doc = cm.doc;
955 var lim = precise ? -1 : n - (cm.doc.mode.innerMode ? 1000 : 100);
956 for (var search = n; search > lim; --search) {
957 if (search <= doc.first) return doc.first;
958 var line = getLine(doc, search - 1);
959 if (line.stateAfter && (!precise || search <= doc.frontier)) return search;
960 var indented = countColumn(line.text, null, cm.options.tabSize);
961 if (minline == null || minindent > indented) {
962 minline = search - 1;
963 minindent = indented;
964 }
965 }
966 return minline;
967 }
968
969 function getStateBefore(cm, n, precise) {
970 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