MCPcopy Create free account
hub / github.com/sql-js/sql.js / getStateBefore

Function getStateBefore

GUI/codemirror/lib/codemirror.js:1436–1450  ·  view source on GitHub ↗
(cm, n, precise)

Source from the content-addressed store, hash-verified

1434 }
1435
1436 function getStateBefore(cm, n, precise) {
1437 var doc = cm.doc, display = cm.display;
1438 if (!doc.mode.startState) return true;
1439 var pos = findStartLine(cm, n, precise), state = pos > doc.first && getLine(doc, pos-1).stateAfter;
1440 if (!state) state = startState(doc.mode);
1441 else state = copyState(doc.mode, state);
1442 doc.iter(pos, n, function(line) {
1443 processLine(cm, line.text, state);
1444 var save = pos == n - 1 || pos % 5 == 0 || pos >= display.viewFrom && pos < display.viewTo;
1445 line.stateAfter = save ? copyState(doc.mode, state) : null;
1446 ++pos;
1447 });
1448 if (precise) doc.frontier = pos;
1449 return state;
1450 }
1451
1452 // POSITION MEASUREMENT
1453

Callers 4

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

Calls 3

findStartLineFunction · 0.85
getLineFunction · 0.85
processLineFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…