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

Function getStateBefore

tools/pythonauto/static/codemirrorepl/codemirrorepl.js:1989–2000  ·  view source on GitHub ↗
(n)

Source from the content-addressed store, hash-verified

1987 return minline;
1988 }
1989 function getStateBefore(n) {
1990 var start = findStartLine(n), state = start && getLine(start-1).stateAfter;
1991 if (!state) state = startState(mode);
1992 else state = copyState(mode, state);
1993 doc.iter(start, n, function(line) {
1994 line.highlight(mode, state, options.tabSize);
1995 line.stateAfter = copyState(mode, state);
1996 });
1997 if (start < n) changes.push({from: start, to: n});
1998 if (n < doc.size && !getLine(n).stateAfter) work.push(n);
1999 return state;
2000 }
2001 function highlightLines(start, end) {
2002 var state = getStateBefore(start);
2003 doc.iter(start, end, function(line) {

Callers 3

CodeMirrorFunction · 0.70
indentLineFunction · 0.70
highlightLinesFunction · 0.70

Calls 4

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

Tested by

no test coverage detected