笙默考试管理系统-MyExamTest----codemirror(30)
目录
},
backUp: function(n) {this.pos -= n;},
column: function() {return countColumn(this.string, this.start, this.tabSize);},
indentation: function() {return countColumn(this.string, null, this.tabSize);},
match: function(pattern, consume, caseInsensitive) {
if (typeof pattern == "string") {
function cased(str) {return caseInsensitive ? str.toLowerCase() : str;}
if (cased(this.string).indexOf(cased(pattern), this.pos) == this.pos) {
if (consume !== false) this.pos += pattern.length;
return true;
}
}
else {
var match = this.string.slice(this.pos).match(pattern);
if (match && consume !== false) this.pos += match[0].length;
return match;
}
},
current: function(){return this.string.slice(this.start, this.pos);}
};
CodeMirror.StringStream = StringStream;
function MarkedText(from, to, className, set) {
this.from = from; this.to = to; this.style = className; this.set = set;
}
MarkedText.prototype = {
attach: function(line) { this.set.push(line); },
detach: function(line) {
var ix = indexOf(this.set, line);
if (ix > -1) this.set.splice(ix, 1);
},
split: function(pos, lenBefore) {
if (this.to <= pos && this.to != null) return null;
var from = this.from < pos || this.from == null ? null : this.from - pos + lenBefore;
var to = this.to == null ? null : this.to - pos + lenBefore;
return new MarkedText(from, to, this.style, this.set);
},
dup: function() { return new MarkedText(null, null, this.style, this.set); },
clipTo: function(fromOpen, from, toOpen, to, diff) {
if (this.from != null && this.from >= from)
this.from = Math.max(to, this.from) + diff;
if (this.to != null && this.to > from)
this.to = to < this.to ? this.to + diff : from;
if (fromOpen && to > this.from && (to < this.to || this.to == null))
this.from = null;
if (toOpen && (from < this.to || this.to == null) && (from > this.from || this.from == null))
this.to = null;