目录
笙默考试管理系统-MyExamTest----codemirror(11)
一、 笙默考试管理系统-MyExamTest----codemirror
二、 笙默考试管理系统-MyExamTest----codemirror
三、 笙默考试管理系统-MyExamTest----codemirror
四、 笙默考试管理系统-MyExamTest----codemirror
五、 笙默考试管理系统-MyExamTest----codemirror
function updateLinesNoUndo(from, to, newText, selFrom, selTo) {
var recomputeMaxLength = false, maxLineLength = maxLine.length;
if (!options.lineWrapping)
doc.iter(from.line, to.line, function(line) {
if (line.text.length == maxLineLength) {recomputeMaxLength = true; return true;}
});
if (from.line != to.line || newText.length > 1) gutterDirty = true;
var nlines = to.line - from.line, firstLine = getLine(from.line), lastLine = getLine(to.line);
// First adjust the line structure, taking some care to leave highlighting intact.
if (from.ch == 0 && to.ch == 0 && newText[newText.length - 1] == "") {
// This is a whole-line replace. Treated specially to make
// sure line objects move the way they are supposed to.
var added = [], prevLine = null;
if (from.line) {
prevLine = getLine(from.line - 1);
prevLine.fixMarkEnds(lastLine);
} else lastLine.fixMarkStarts();
for (var i = 0, e = newText.length - 1; i < e; ++i)
added.push(Line.inheritMarks(newText[i], prevLine));
if (nlines) doc.remove(from.line, nlines, callbacks);
if (added.length) doc.insert(from.line, added);
} else if (firstLine == lastLine) {
if (newText.length == 1)
firstLine.replace(from.ch, to.ch, newText[0]);
else {
lastLine = firstLine.split(to.ch, newText[newText.length-1]);
firstLine.replace(from.ch, null, newText[0]);
firstLine.fixMarkEnds(lastLine);
var added = [];
for (var i = 1, e = newText.length - 1; i < e; ++i)
added.push(Line.inheritMarks(newText[i], firstLine));
added.push(lastLine);
doc.insert(from.line + 1, added);
}
} else if (newText.length == 1) {
firstLine.replace(from.ch, null, newText[0]);
lastLine.replace(null, to.ch, "");
firstLine.append(lastLine);
doc.remove(from.line + 1, nlines, callbacks);