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

Function getStateBefore

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

Source from the content-addressed store, hash-verified

967 }
968
969 function getStateBefore(cm, n, precise) {
970 var doc = cm.doc, display = cm.display;
971 if (!doc.mode.startState) return true;
972 var pos = findStartLine(cm, n, precise), state = pos > doc.first && getLine(doc, pos-1).stateAfter;
973 if (!state) state = startState(doc.mode);
974 else state = copyState(doc.mode, state);
975 doc.iter(pos, n, function(line) {
976 processLine(cm, line.text, state);
977 var save = pos == n - 1 || pos % 5 == 0 || pos >= display.showingFrom && pos < display.showingTo;
978 line.stateAfter = save ? copyState(doc.mode, state) : null;
979 ++pos;
980 });
981 if (precise) doc.frontier = pos;
982 return state;
983 }
984
985 // POSITION MEASUREMENT
986

Callers 4

highlightWorkerFunction · 0.70
indentLineFunction · 0.70
codemirror.jsFile · 0.70
getLineStylesFunction · 0.70

Calls 5

findStartLineFunction · 0.70
getLineFunction · 0.70
startStateFunction · 0.70
copyStateFunction · 0.70
processLineFunction · 0.70

Tested by

no test coverage detected