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

Function getStateBefore

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

Source from the content-addressed store, hash-verified

1419 }
1420
1421 function getStateBefore(cm, n, precise) {
1422 var doc = cm.doc, display = cm.display;
1423 if (!doc.mode.startState) return true;
1424 var pos = findStartLine(cm, n, precise), state = pos > doc.first && getLine(doc, pos-1).stateAfter;
1425 if (!state) state = startState(doc.mode);
1426 else state = copyState(doc.mode, state);
1427 doc.iter(pos, n, function(line) {
1428 processLine(cm, line.text, state);
1429 var save = pos == n - 1 || pos % 5 == 0 || pos >= display.viewFrom && pos < display.viewTo;
1430 line.stateAfter = save ? copyState(doc.mode, state) : null;
1431 ++pos;
1432 });
1433 if (precise) doc.frontier = pos;
1434 return state;
1435 }
1436
1437 // POSITION MEASUREMENT
1438

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