笙默考试管理系统-MyExamTest----codemirror(33)
目录
一、 笙默考试管理系统-MyExamTest
二、 笙默考试管理系统-MyExamTest
三、 笙默考试管理系统-MyExamTest
四、 笙默考试管理系统-MyExamTest
五、 笙默考试管理系统-MyExamTest
}
},
// Split a part off a line, keeping styles and markers intact.
split: function(pos, textBefore) {
var st = [textBefore, null], mk = this.marked;
copyStyles(pos, this.text.length, this.styles, st);
var taken = new Line(textBefore + this.text.slice(pos), st);
if (mk) {
for (var i = 0; i < mk.length; ++i) {
var mark = mk[i];
var newmark = mark.split(pos, textBefore.length);
if (newmark) {
if (!taken.marked) taken.marked = [];
taken.marked.push(newmark); newmark.attach(taken);
}
}
}
return taken;
},
append: function(line) {
var mylen = this.text.length, mk = line.marked, mymk = this.marked;
this.text += line.text;
copyStyles(0, line.text.length, line.styles, this.styles);
if (mymk) {
for (var i = 0; i < mymk.length; ++i)
if (mymk[i].to == null) mymk[i].to = mylen;
}
if (mk && mk.length) {
if (!mymk) this.marked = mymk = [];
outer: for (var i = 0; i < mk.length; ++i) {
var mark = mk[i];
if (!mark.from) {
for (var j = 0; j < mymk.length; ++j) {
var mymark = mymk[j];
if (mymark.to == mylen && mymark.sameSet(mark)) {
mymark.to = mark.to == null ? null : mark.to + mylen;
if (mymark.isDead()) {
mymark.detach(this);
mk.splice(i--, 1);
}
continue outer;
}
}
}
mymk.push(mark);
mark.attach(this);
mark.from += mylen;
if (mark.to != null) mark.to += mylen;
}
}
},
fixMarkEnds: function(other) {
var mk = this.marked, omk = other.marked;
if (!mk) return;
for (var i = 0; i < mk.length; ++i) {
var mark = mk[i], close = mark.to == null;
if (close && omk) {
for (var j = 0; j < omk.length; ++j)
if (omk[j].sameSet(mark)) {close = false; break;}
}
if (close) mark.to = this.text.length;
}
},
fixMarkStarts: function() {
var mk = this.marked;
if (!mk) return;
for (var i = 0; i < mk.length; ++i)
if (mk[i].from == null) mk[i].from = 0;
},