MCPcopy Create free account
hub / github.com/ronreiter/interactive-tutorials / getStateBefore

Function getStateBefore

static/js/codemirror/codemirror.js:916–929  ·  view source on GitHub ↗
(cm, n)

Source from the content-addressed store, hash-verified

914 }
915
916 function getStateBefore(cm, n) {
917 var doc = cm.doc, display = cm.display;
918 if (!doc.mode.startState) return true;
919 var pos = findStartLine(cm, n), state = pos > doc.first && getLine(doc, pos-1).stateAfter;
920 if (!state) state = startState(doc.mode);
921 else state = copyState(doc.mode, state);
922 doc.iter(pos, n, function(line) {
923 processLine(cm, line, state);
924 var save = pos == n - 1 || pos % 5 == 0 || pos >= display.showingFrom && pos < display.showingTo;
925 line.stateAfter = save ? copyState(doc.mode, state) : null;
926 ++pos;
927 });
928 return state;
929 }
930
931 // POSITION MEASUREMENT
932

Callers 4

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

Calls 5

findStartLineFunction · 0.85
getLineFunction · 0.85
startStateFunction · 0.85
copyStateFunction · 0.85
processLineFunction · 0.85

Tested by

no test coverage detected