MCPcopy
hub / github.com/hokein/electron-sample-apps / getStateBefore

Function getStateBefore

mini-code-editor/cm/lib/codemirror.js:1789–1800  ·  view source on GitHub ↗
(n)

Source from the content-addressed store, hash-verified

1787 return minline;
1788 }
1789 function getStateBefore(n) {
1790 var start = findStartLine(n), state = start && getLine(start-1).stateAfter;
1791 if (!state) state = startState(mode);
1792 else state = copyState(mode, state);
1793 doc.iter(start, n, function(line) {
1794 line.highlight(mode, state, options.tabSize);
1795 line.stateAfter = copyState(mode, state);
1796 });
1797 if (start < n) changes.push({from: start, to: n});
1798 if (n < doc.size && !getLine(n).stateAfter) work.push(n);
1799 return state;
1800 }
1801 function highlightLines(start, end) {
1802 var state = getStateBefore(start);
1803 doc.iter(start, end, function(line) {

Callers 3

CodeMirrorFunction · 0.85
indentLineFunction · 0.85
highlightLinesFunction · 0.85

Calls 4

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

Tested by

no test coverage detected