笙默考试管理系统-MyExamTest----codemirror(20)
目录
一、 笙默考试管理系统-MyExamTest----codemirror
二、 笙默考试管理系统-MyExamTest----codemirror
三、 笙默考试管理系统-MyExamTest----codemirror
四、 笙默考试管理系统-MyExamTest----codemirror
五、 笙默考试管理系统-MyExamTest----codemirror
function setShift(val) {
if (val) shiftSelecting = shiftSelecting || (sel.inverted ? sel.to : sel.from);
else shiftSelecting = null;
}
function setSelectionUser(from, to) {
var sh = shiftSelecting && clipPos(shiftSelecting);
if (sh) {
if (posLess(sh, from)) from = sh;
else if (posLess(to, sh)) to = sh;
}
setSelection(from, to);
userSelChange = true;
}
// Update the selection. Last two args are only used by
// updateLines, since they have to be expressed in the line
// numbers before the update.
function setSelection(from, to, oldFrom, oldTo) {
goalColumn = null;
if (oldFrom == null) {oldFrom = sel.from.line; oldTo = sel.to.line;}
if (posEq(sel.from, from) && posEq(sel.to, to)) return;
if (posLess(to, from)) {var tmp = to; to = from; from = tmp;}
// Skip over hidden lines.
if (from.line != oldFrom) from = skipHidden(from, oldFrom, sel.from.ch);
if (to.line != oldTo) to = skipHidden(to, oldTo, sel.to.ch);
if (posEq(from, to)) sel.inverted = false;
else if (posEq(from, sel.to)) sel.inverted = false;
else if (posEq(to, sel.from)) sel.inverted = true;
// Some ugly logic used to only mark the lines that actually did
// see a change in selection as changed, rather than the whole
// selected range.
if (posEq(from, to)) {
if (!posEq(sel.from, sel.to))
changes.push({from: oldFrom, to: oldTo + 1});
}
else if (posEq(sel.from, sel.to)) {
changes.push({from: from.line, to: to.line + 1});
}
else {
if (!posEq(from, sel.from)) {
if (from.line < oldFrom)
changes.push({from: from.line, to: Math.min(to.line, oldFrom) + 1});
Else
changes.push({from: oldFrom, to: Math.min(oldTo, from.line) + 1});
}