目录
笙默考试管理系统-MyExamTest----codemirror(23)
一、 笙默考试管理系统-MyExamTest
二、 笙默考试管理系统-MyExamTest
三、 笙默考试管理系统-MyExamTest
四、 笙默考试管理系统-MyExamTest
五、 笙默考试管理系统-MyExamTest
function setBookmark(pos) {
pos = clipPos(pos);
var bm = new Bookmark(pos.ch);
getLine(pos.line).addMark(bm);
return bm;
}
function addGutterMarker(line, text, className) {
if (typeof line == "number") line = getLine(clipLine(line));
line.gutterMarker = {text: text, style: className};
gutterDirty = true;
return line;
}
function removeGutterMarker(line) {
if (typeof line == "number") line = getLine(clipLine(line));
line.gutterMarker = null;
gutterDirty = true;
}
function changeLine(handle, op) {
var no = handle, line = handle;
if (typeof handle == "number") line = getLine(clipLine(handle));
else no = lineNo(handle);
if (no == null) return null;
if (op(line, no)) changes.push({from: no, to: no + 1});
else return null;
return line;
}
function setLineClass(handle, className) {
return changeLine(handle, function(line) {
if (line.className != className) {
line.className = className;
return true;
}
});
}
function setLineHidden(handle, hidden) {
return changeLine(handle, function(line, no) {
if (line.hidden != hidden) {
line.hidden = hidden;
updateLineHeight(line, hidden ? 0 : 1);
if (hidden && (sel.from.line == no || sel.to.line == no))
setSelection(skipHidden(sel.from, sel.from.line, sel.from.ch),
skipHidden(sel.to, sel.to.line, sel.to.ch));
return (gutterDirty = true);
}
});
}
function lineInfo(line) {
if (typeof line == "number") {
if (!isLine(line)) return null;
var n = line;
line = getLine(line);
if (!line) return null;
}
else {
var n = lineNo(line);
if (n == null) return null;
}
var marker = line.gutterMarker;
return {line: n, handle: line, text: line.text, markerText: marker && marker.text,
markerClass: marker && marker.style, lineClass: line.className};
}
function stringWidth(str) {
measure.innerHTML = "x
";
measure.firstChild.firstChild.firstChild.nodeValue = str;
return measure.firstChild.firstChild.offsetWidth || 10;
}
// These are used to go from pixel positions to character
// positions, taking varying character widths into account.
function charFromX(line, x) {
if (x <= 0) return 0;
var lineObj = getLine(line), text = lineObj.text;
function getX(len) {
measure.innerHTML = "" + lineObj.getHTML(null, null, false, tabText, len) + "
";
return measure.firstChild.firstChild.offsetWidth;
}
var from = 0, fromX = 0, to = text.length, toX;
// Guess a suitable upper bound for our search.
var estimated = Math.min(to, Math.ceil(x / charWidth()));
for (;;) {
var estX = getX(estimated);
if (estX <= x && estimated < to) estimated = Math.min(to, Math.ceil(estimated * 1.2));
else {toX = estX; to = estimated; break;}