MCPcopy
hub / github.com/witheve/Eve / getStateBefore

Function getStateBefore

src/codemirror.js:2504–2518  ·  view source on GitHub ↗
(cm, n, precise)

Source from the content-addressed store, hash-verified

2502 }
2503
2504 function getStateBefore(cm, n, precise) {
2505 var doc = cm.doc, display = cm.display;
2506 if (!doc.mode.startState) return true;
2507 var pos = findStartLine(cm, n, precise), state = pos > doc.first && getLine(doc, pos-1).stateAfter;
2508 if (!state) state = startState(doc.mode);
2509 else state = copyState(doc.mode, state);
2510 doc.iter(pos, n, function(line) {
2511 processLine(cm, line.text, state);
2512 var save = pos == n - 1 || pos % 5 == 0 || pos >= display.viewFrom && pos < display.viewTo;
2513 line.stateAfter = save ? copyState(doc.mode, state) : null;
2514 ++pos;
2515 });
2516 if (precise) doc.frontier = pos;
2517 return state;
2518 }
2519
2520 // POSITION MEASUREMENT
2521

Callers 5

highlightWorkerFunction · 0.85
indentLineFunction · 0.85
codemirror.jsFile · 0.85
takeTokenFunction · 0.85
getLineStylesFunction · 0.85

Calls 3

findStartLineFunction · 0.85
getLineFunction · 0.85
processLineFunction · 0.85

Tested by

no test coverage detected