笙默考试管理系统-MyExamTest----codemirror(43)
目录
一、 笙默考试管理系统-MyExamTest----codemirror
二、 笙默考试管理系统-MyExamTest----codemirror
三、 笙默考试管理系统-MyExamTest----codemirror
四、 笙默考试管理系统-MyExamTest----codemirror
五、 笙默考试管理系统-MyExamTest----codemirror
// Line objects. These hold state related to a line, including
// highlighting info (the styles array).
function Line(text, styles) {
this.styles = styles || [text, null];
this.text = text;
this.height = 1;
this.marked = this.gutterMarker = this.className = this.handlers = null;
this.stateAfter = this.parent = this.hidden = null;
}
Line.inheritMarks = function(text, orig) {
var ln = new Line(text), mk = orig && orig.marked;
if (mk) {
for (var i = 0; i < mk.length; ++i) {
if (mk[i].to == null && mk[i].style) {
var newmk = ln.marked || (ln.marked = []), mark = mk[i];
var nmark = mark.dup(); newmk.push(nmark); nmark.attach(ln);
}
}
}
return ln;
}
Line.prototype = {
// Replace a piece of a line, keeping the styles around it intact.
replace: function(from, to_, text) {
var st = [], mk = this.marked, to = to_ == null ? this.text.length : to_;
copyStyles(0, from, this.styles, st);
if (text) st.push(text, null);
copyStyles(to, this.text.length, this.styles, st);
this.styles = st;
this.text = this.text.slice(0, from) + text + this.text.slice(to);
this.stateAfter = null;
if (mk) {
var diff = text.length - (to - from);
for (var i = 0, mark = mk[i]; i < mk.length; ++i) {
mark.clipTo(from == null, from || 0, to_ == null, to, diff);
if (mark.isDead()) {mark.detach(this); mk.splice(i--, 1);}
}
}
}, };