笙默考试管理系统-MyExamTest----codemirror(26)
目录
一、 笙默考试管理系统-MyExamTest----codemirror
二、 笙默考试管理系统-MyExamTest----codemirror
三、 笙默考试管理系统-MyExamTest----codemirror
四、 笙默考试管理系统-MyExamTest----codemirror
五、 笙默考试管理系统-MyExamTest----codemirror
return minline;
}
function getStateBefore(n) {
var start = findStartLine(n), state = start && getLine(start-1).stateAfter;
if (!state) state = startState(mode);
else state = copyState(mode, state);
doc.iter(start, n, function(line) {
line.highlight(mode, state, options.tabSize);
line.stateAfter = copyState(mode, state);
});
if (start < n) changes.push({from: start, to: n});
if (n < doc.size && !getLine(n).stateAfter) work.push(n);
return state;
}
function highlightLines(start, end) {
var state = getStateBefore(start);
doc.iter(start, end, function(line) {
line.highlight(mode, state, options.tabSize);
line.stateAfter = copyState(mode, state);
});
}
function highlightWorker() {
var end = +new Date + options.workTime;
var foundWork = work.length;
while (work.length) {
if (!getLine(showingFrom).stateAfter) var task = showingFrom;
else var task = work.pop();
if (task >= doc.size) continue;
var start = findStartLine(task), state = start && getLine(start-1).stateAfter;
if (state) state = copyState(mode, state);
else state = startState(mode);
var unchanged = 0, compare = mode.compareStates, realChange = false,
i = start, bail = false;
doc.iter(i, doc.size, function(line) {
var hadState = line.stateAfter;
if (+new Date > end) {
work.push(i);
startWorker(options.workDelay);
if (realChange) changes.push({from: task, to: i + 1});
return (bail = true);
}
var changed = line.highlight(mode, state, options.tabSize);
if (changed) realChange = true;
line.stateAfter = copyState(mode, state);
if (compare) {
if (hadState && compare(hadState, state)) return true;
} else {
if (changed !== false || !hadState) unchanged = 0;
else if (++unchanged > 3 && (!mode.indent || mode.indent(hadState, "") == mode.indent(state, "")))
return true;
}
++i;
});
if (bail) return;
if (realChange) changes.push({from: task, to: i + 1});
}
if (foundWork && options.onHighlightComplete)
options.onHighlightComplete(instance);
}
function startWorker(time) {
if (!work.length) return;
highlight.set(time, operation(highlightWorker));
}
// Operations are used to wrap changes in such a way that each
// change won't have to update the cursor and display (which would
// be awkward, slow, and error-prone), but instead updates are
// batched and then all combined and executed at once.
function startOperation() {
updateInput = userSelChange = textChanged = null;
changes = []; selectionChanged = false; callbacks = [];
}