MCPcopy
hub / github.com/DHTMLX/gantt / getContextBefore

Function getContextBefore

samples/common/codehighlight/codemirror.js:1127–1142  ·  view source on GitHub ↗
(cm, n, precise)

Source from the content-addressed store, hash-verified

1125 }
1126
1127 function getContextBefore(cm, n, precise) {
1128 var doc = cm.doc, display = cm.display;
1129 if (!doc.mode.startState) { return new Context(doc, true, n) }
1130 var start = findStartLine(cm, n, precise);
1131 var saved = start > doc.first && getLine(doc, start - 1).stateAfter;
1132 var context = saved ? Context.fromSaved(doc, saved, start) : new Context(doc, startState(doc.mode), start);
1133
1134 doc.iter(start, n, function (line) {
1135 processLine(cm, line.text, context);
1136 var pos = context.line;
1137 line.stateAfter = pos == n - 1 || pos % 5 == 0 || pos >= display.viewFrom && pos < display.viewTo ? context.save() : null;
1138 context.nextLine();
1139 });
1140 if (precise) { doc.modeFrontier = context.line; }
1141 return context
1142 }
1143
1144 // Lightweight form of highlight -- proceed over this line and
1145 // update state, but don't save a style array. Used for lines that

Callers 5

getLineStylesFunction · 0.85
takeTokenFunction · 0.85
highlightWorkerFunction · 0.85
indentLineFunction · 0.85
addEditorMethodsFunction · 0.85

Calls 5

findStartLineFunction · 0.85
getLineFunction · 0.85
startStateFunction · 0.85
processLineFunction · 0.85
saveMethod · 0.65

Tested by

no test coverage detected